找不到可安装的 ISAM
我有以下代码:
string excelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\db\suc.xls; Extended Properties=""Excel 12.0;HDR=YES;""";
// Create Connection to Excel Workbook
using (OleDbConnection connection =
new OleDbConnection(excelConnectionString))
{
OleDbCommand command = new OleDbCommand
("Select * FROM [Sheet1$]", connection);
connection.Open();
并且出现以下错误:
找不到可安装的 ISAM。
在connection.Open()
处。有什么想法吗?
I have the following code :
string excelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\db\suc.xls; Extended Properties=""Excel 12.0;HDR=YES;""";
// Create Connection to Excel Workbook
using (OleDbConnection connection =
new OleDbConnection(excelConnectionString))
{
OleDbCommand command = new OleDbCommand
("Select * FROM [Sheet1$]", connection);
connection.Open();
and i get the following error :
Could not find installable ISAM.
at connection.Open()
. Any ideas ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我有同样的错误,但上面的建议都不起作用。就我而言,我所要做的就是将连接字符串更改为:
注意扩展属性属性周围的单引号('Excel 12.0;IMEX=1;')。一旦我添加了这些单引号,错误就消失了!
I had the same error, but none of the suggestions above worked. In my case all I had to do was to change my connection string to this:
Note the Single Quote around the Extended Properties attribute ('Excel 12.0;IMEX=1;'). Once I added those single quotes the error disappeared!
Jet OLEDB 驱动程序没有 64 位版本,因此如果您在 64 位操作系统上运行该驱动程序,您可能需要在 .NET 应用程序中以
x86
为目标,而不是任何 CPU
:There's no 64 bit version of the Jet OLEDB drivers, so if you are running this on a 64 bit OS you might need to target
x86
in your .NET application and notAny CPU
:我在尝试使用更新的提供商打开 xls 文件时遇到此问题。
我通过将扩展属性从更改为“我猜 Excel 11 需要 xlsx 样式文件”来解决此
问题
。
I was getting this issue trying to opening an xls file with a more recent provider.
I fixed this issue by changing my extended properties from
to
I guess Excel 11 expects an xlsx style file.
在 64 位 Windows 和 64 位 Office(2010、2013)环境中,有很多关于此错误的报告。修复或解决方法有点奇怪,但似乎对大多数人都有效。
“Microsoft Access Database Engine 2010 Redistributable”安装包似乎这是一种很自然的方法,但有几份报告称它不起作用。
相反,使用“2007 Office System 驱动程序:数据连接组件< /a>”似乎可以解决大多数人的上述问题。
On 64-bit Windows and 64-bit Office (2010, 2013) environments, there are many reports on this error. The fix or workaround is a bit strange but seems to work for most people out there.
The "Microsoft Access Database Engine 2010 Redistributable" installation package seems the natural one to use but several reports says it does not work.
Instead, using the "2007 Office System Driver: Data Connectivity Components" seems to solve the above problem for most people.
使用扩展属性=“\excel 8.0;”
use
Extended properties="\excel 8.0;
我有同样的问题。我使用的是 Excel 2010 数据库。但我有一个 xlsx 文件而不是 xls。我使用连接字符串作为休闲解决了我的问题,
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=logbook.xlsx;Extended Properties='Excel 12.0;HDR=YES;IMEX=1;';
我所缺少的是,
我使用 OLEDB.4.0 而不是 ACE.12.0 。我尝试使用 ACE.14.0。但它也不起作用。
然后我错过了扩展属性周围的引号('')。
抱歉,如果答案难以阅读,我正在将其上传到手机中。
I had the same kind of problem. I was using an Excel 2010 database. But I had a xlsx file instead of xls. I solved my problem using the connection string as fallows,
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=logbook.xlsx;Extended Properties='Excel 12.0;HDR=YES;IMEX=1;';
What I was missing are,
I used OLEDB.4.0 instead of ACE.12.0 . I tried using ACE.14.0. But it didn't work either.
Then I missed inverted commas ( ' ' ) around Extended Properties.
Sorry if the answer is hard to read, I am uploading this in my phone.
// 设置与 Excel 文件的连接。
在扩展属性中添加单引号,例如
扩展属性 ='Excel 12.0:HDR=YES' 解决了我的问题。
// SET A CONNECTION WITH THE EXCEL FILE.
Putting Single quote in Extended Properties like
Extended Properties ='Excel 12.0:HDR=YES' solved my problem.