查询 Excel 2010 时诊断 OLEDB 异常
要通过 SQL 查询 Excel 工作表,我曾经使用:
Dim excelConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strPath + ";Extended Properties=""Excel 8.0;IMEX=1;HDR=YES;"""
或
Dim excelConnectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " + strPath + ";Extended Properties=""Excel 12.0;IMEX=1;HDR=YES;"""
现在这工作正常,直到我安装了 Office 2010。
现在我得到了
Microsoft.Ace.OLEDB.12.0 提供程序未在此计算机上注册 异常。
如何找到正确的连接字符串/提供程序?
To query an excel sheet via SQL, I used to use either:
Dim excelConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strPath + ";Extended Properties=""Excel 8.0;IMEX=1;HDR=YES;"""
or
Dim excelConnectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " + strPath + ";Extended Properties=""Excel 12.0;IMEX=1;HDR=YES;"""
Now this worked fine until I installed Office 2010.
Now I get a
Microsoft.Ace.OLEDB.12.0 provider is not registered on this machine
exception.
How can I find out the correct connection string/provider?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我相信对于 Excel 2010 来说是这样的:
这似乎在我的视觉工作室中工作,我让 Excel 生成查询字符串,并且其中有额外的条目。
I believe for Excel 2010 it is :
This appears to work in my visual studio, I got Excel to generate the query string and it had the extra entry in it.
我按照上面的建议下载并安装了 Office 系统驱动程序:数据连接组件 - 以下代码有效:
I downloaded and installed Office System Driver: Data Connectivity Components as advised above - and the below code worked:
也许您卸载了 Access 数据库引擎 (ACE) 组件?它们仍然可以从 MSDN 下载,格式为 2007 Office 系统驱动程序:数据连接组件。
Perhaps you uninstalled the Access Database Engine (ACE) components? They are still available for download from MSDN as 2007 Office System Driver: Data Connectivity Components.