找不到可安装的 ISAM vb.net

could not find installable ISAM vb.net

我对此有疑问。它找不到 installbe ISAM 我已经在 x86 中更改了目标 cpu Image of error

Dim con_excel As New System.Data.OleDb.OleDbConnection(" Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & TextBox1.Text & "'; Extend Poroperties="" Excel 16.0;HDR=No"" ")
        con_excel.Open()
        Dim qry_excel As String = "Select * from [Sheet1$]"

我已经为此安装了 AccessDatabaseEngine

我正在使用 excel 2016 我应该使用这个

Extend Poroperties="" Excel 16.0;HDR=Yes""
or
Extend Poroperties="" Excel 12.0;HDR=Yes""

您的连接字符串中存在严重的语法错误:

"'; Extend Poroperties="" Excel 16.0;HDR=No"" ")

Extend => Extended
Poroperties => Properties

这应该是(将 HDR 设置为任何需要的值。为安全起见,请保留 IMEX=1):

";Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1;"""

更改为:

Dim ConnectionString As String =
    "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & TextBox1.Text &
    ";Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1"""

或:

Dim ConnectionString As String =
    "Provider=Microsoft.ACE.OLEDB.16.0;Data Source=" & TextBox1.Text &
    ";Extended Properties=""Excel 16.0 Xml;HDR=YES;IMEX=1"""

Dim con_excel As New OleDbConnection(ConnectionString)

请注意 TextBox1.Text 必须 提供 Excel 文件的完整路径。

下载并安装所需的数据库引擎(32 位或 64 位)。

Microsoft Access Database Engine 2010 Redistributable
Microsoft Access Database Engine 2016 Redistributable

关于Compile模式:
设置 Project properties => Compile => AnyCPU
设置 VS Debug Mode => AnyCPU