有没有人将大量数据从 Datatable 移动到 Excel 中的经验?
不是来自 DataTable 对象,而是使用 Excel 内置的数据导入功能的数据量,是的。
@slugster 建议“从 Excel 设置数据源并使用脏读运行查询”......是否可以在 Excel 中设置链接到非物化数据表的数据源?
我也建议这样做。更进一步,我建议创建一个存储过程然后调用它。您应该会看到使用存储过程的更好性能。该程序可以收集和准备数据,然后将其返回到 Excel。此外,您可以在过程中构建缓存机制。例如,如果您的数据每天只更改一次,那么您每天只在源表中重建一次数据,因此只有第一个请求数据的用户会受到初始性能影响。此外,根据您在 VBA 中的 Excel 中执行的后处理类型,也许这也可以在过程中进行处理。如果您将 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED 添加到过程的顶部,该过程还将有助于减少锁定问题的可能性,
Here's a nice article regarding using stored procedures in Excel: http://codebyjoshua.blogspot.com/2012/01/get-data-from-sql-server-stored.html
Will looping through a table that is 30000 rows by 10 columns via xl
interop run into problems?
This depends on your definition of "problems." I could see possible performance implications, however if you handle as much as you can in the stored procedure, you should be fine. In the world of data, that's really teeny tiny.