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

 找回密码
 注册
搜索
打印 上一主题 下一主题

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

[复制链接]
跳转到指定楼层
1#
发表于 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, 2024-12-1 14:49 , Processed in 0.016080 second(s), 11 queries , File On.

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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