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

 找回密码
 注册
搜索

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

[复制链接]
发表于 2012-11-22 22:09:20 | 显示全部楼层 |阅读模式
如果遇见这两个错误:
错误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()
复制代码

手机版|大马资讯论坛  

GMT+8, 2022-1-17 06:54 , Processed in 0.014655 second(s), 13 queries , File On.

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表