要通过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提供程序未在此计算机上注册异常 .
如何找到正确的连接字符串/提供程序?
3 回答
也许您卸载了Access数据库引擎(ACE)组件?它们仍然可以从MSDN下载2007 Office System Driver: Data Connectivity Components .
我相信Excel 2010它是:
这似乎在我的视觉工作室中工作,我得到Excel生成查询字符串,它有额外的条目 .
我按照上面的建议下载并安装了Office System Driver:Data Connectivity Components - 以下代码有效: