资讯王 发表于 2012-11-22 22:09:20

C# excel错误external table is not in the expected format[解决]

如果遇见这两个错误:
错误1:external table is not in the expected format
错误2:Cannot find installable ISAM

如果你的电脑不错使用ACE OLEDB,需要下载Microsoft access runtime
http://www.microsoft.com/en-us/download/details.aspx?id=13255

试试看吧,把Microsoft.Jet.OLEDB换成Microsoft.ACE.OLEDB吧

C#范例public static string path = @"C:\abcd.xlsx";
public static string connStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;";
VB.net范例Dim MyConnection As New OleDbConnection()
MyConnection = New OleDbConnection()
MyConnection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & myPath & "';Extended Properties=Excel 12.0;"
MyConnection.Open()
页: [1]
查看完整版本: C# excel错误external table is not in the expected format[解决]