3

我有一个可供 3 个用户使用的测试台应用程序。

如果所有用户同时运行该应用程序,则一个存储过程运行,并且所有三个都将具有结果集,当前使用ADO.NET Datatable大约 30,000 条记录,然后应用程序需要将这些记录移动到每个记录的 Excel 模板中。

模板是一个xlsm文件,其中包含一些VBA在导入数据后需要运行的文件。此模板保存在解决方案中。

我将尝试将数据从使用移动DataTableworksheetExcel-Interop

有没有人将这么多数据从 Datatable 移动到 Excel 中的经验?

@slugster 建议“从 Excel 设置数据源并使用脏读运行查询”......是否可以设置Excel链接到非物化数据表的数据源?

循环遍历 30000 行 x 10 列的表会xl interop遇到问题吗?

4

1 回答 1

1

有没有人将大量数据从 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.

于 2014-06-05T12:37:22.427 回答