求助:VB6下不能使用SQL语句将Excel表格中的数据批量导入SQLServer?
我在查询分析器下运行这句SQL语句是成功了的:
INSERT INTO Tbl1
select *
from openrowset
(
'Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;Database=C:\Imports2.xls',
'select * from [Sheet1$]'
)
但在VB6中运行这句时,始终出现“[OLE/DB provider returned message: The Microsoft Access database engine cannot open or write to the file ''. It is already opened exclusively by another user, or you need permission to view and write its data.]“这个错误。我的Excel文件并没有打开啊。
请高手指点,万分感激!!!
excel
vb
SQL?Server?
导入
------解决方案--------------------把文件换个路径,不要放在C:\下,复制为D:\Imports2.xls
然后再执行..
INSERT INTO Tbl1
select *
from openrowset
(
'Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;Database=D:\Imports2.xls',
'select * from [Sheet1$]'
)