在Quering Excel 2010中诊断OLEDB异常

Ste*_*ger 2 sql vb.net excel ms-office excel-2010

要通过SQL查询excel表,我曾经使用过:

Dim excelConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strPath + ";Extended Properties=""Excel 8.0;IMEX=1;HDR=YES;"""
Run Code Online (Sandbox Code Playgroud)

要么

Dim excelConnectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " + strPath + ";Extended Properties=""Excel 12.0;IMEX=1;HDR=YES;"""
Run Code Online (Sandbox Code Playgroud)

现在这个工作正常,直到我安装了Office 2010.

现在我得到了

Microsoft.Ace.OLEDB.12.0提供程序未在此计算机上注册异常.

如何找到正确的连接字符串/提供程序?

JDu*_*ley 7

我相信Excel 2010它是:

Dim excelConnectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Password="""";User ID=Admin;Data Source=D:\\MyDocs\\oledb.xlsx;Mode=Share Deny Write;Extended Properties=""HDR=YES;"";Jet OLEDB:Engine Type=37"
Run Code Online (Sandbox Code Playgroud)

这似乎在我的视觉工作室中工作,我得到Excel生成查询字符串,它有额外的条目.