大马资讯论坛 - 马来西亚中文资讯平台

标题: C# excel错误external table is not in the expected format[解决] [打印本页]

作者: 资讯王    时间: 2012-11-22 22:09
标题: 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#范例
  1. public static string path = @"C:\abcd.xlsx";
  2. public static string connStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;";
复制代码
VB.net范例
  1. Dim MyConnection As New OleDbConnection()
  2. MyConnection = New OleDbConnection()
  3. MyConnection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & myPath & "';Extended Properties=Excel 12.0;"
  4. MyConnection.Open()
复制代码





欢迎光临 大马资讯论坛 - 马来西亚中文资讯平台 (http://freeinfo.com.my/) Powered by Discuz! X3.3