【发布时间】:2017-05-24 07:10:15
【问题描述】:
我在 Excel 中有大量数据需要上传到 SQL Server,但我使用 Access 作为前端。 Excel 中的列数约为 90,记录数超过 700,000
【问题讨论】:
-
欢迎来到 StackOverflow。请阅读stackoverflow.com/help/how-to-ask,并尝试通过更多信息改进您的问题。您已经尝试了什么,什么不起作用,等等。
-
下载 SQL Server Management Studio 并在 Access OLEDB 提供程序的帮助下使用 OPENROWSET 查询文件。
-
嗨 Pawel,我尝试了下面的代码,但它给了我错误或找不到对象,因为我正在使用“匹配”功能。首先使用 SQL 列检查 Excel 数据的列 For col = 0 To .Fields.count - 1 index = xlApp.Application.Match(.Fields(col).Name, sourceRange.Rows(2), 0) If index > 0 Then exportFieldsCount = exportFieldsCount + 1 tableFields(exportFieldsCount) = col rangeFields(exportFieldsCount) = index End If Next 然后将数据添加到 Recordset。但是 Recordset.UpdateBatch 也不起作用
-
嗨 Pawel,你能分享任何可以帮助我的文章或链接吗
-
For col = 0 To .Fields.count - 1 index = xlApp.Application.Match(.Fields(col).Name, sourceRange.Rows(2), 0) If index > 0 Then exportFieldsCount = exportFieldsCount + 1 tableFields(exportFieldsCount) = col rangeFields(exportFieldsCount) = index End If Next 上面的代码给了我 Method Not found 因为我使用的是 Access 但函数是 Excel 的
标签: sql-server ms-access file-upload vba