简体   繁体   English

找不到可安装的 ISAM

[英]Could not find installable ISAM

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.找不到可安装的 ISAM。

at connection.Open() .connection.Open() Any ideas?有任何想法吗?

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:在我的例子中,我所要做的就是将我的连接字符串更改为:

string connStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FilePath + ";Extended Properties='Excel 12.0;IMEX=1;'";

Note the Single Quote around the Extended Properties attribute ('Excel 12.0;IMEX=1;').请注意 Extended Properties 属性周围的单引号 ('Excel 12.0;IMEX=1;')。 Once I added those single quotes the error disappeared!一旦我添加了那些单引号,错误就消失了!

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 not Any CPU :没有 64 位版本的 Jet OLEDB 驱动程序,因此如果您在 64 位操作系统上运行它,您可能需要在 .NET 应用程序中以x86为目标,而不是Any CPU

替代文字

I was getting this issue trying to opening an xls file with a more recent provider.我在尝试使用更新的提供商打开 xls 文件时遇到了这个问题。 I fixed this issue by changing my extended properties from我通过更改我的扩展属性来解决这个问题

Extended Properties="Excel 11.0;"

to

Extended Properties="Excel 8.0;"

I guess Excel 11 expects an xlsx style file.我想 Excel 11 需要一个 xlsx 样式的文件。

On 64-bit Windows and 64-bit Office (2010, 2013) environments, there are many reports on this error.在 64 位 Windows 和 64 位 Office(2010、2013)环境中,有很多关于此错误的报告。 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. Microsoft Access Database Engine 2010 Redistributable ”安装包似乎很自然,但有几份报告称它不起作用。

Instead, using the " 2007 Office System Driver: Data Connectivity Components " seems to solve the above problem for most people.相反,使用“ 2007 Office System 驱动程序:数据连接组件”似乎可以解决大多数人的上述问题。

use Extended properties="\excel 8.0;使用Extended properties="\excel 8.0;

I had the same kind of problem.我有同样的问题。 I was using an Excel 2010 database.我使用的是 Excel 2010 数据库。 But I had a xlsx file instead of xls.但是我有一个 xlsx 文件而不是 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;'; 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.我缺少的是,我使用了 OLEDB.4.0 而不是 ACE.12.0。 I tried using ACE.14.0.我尝试使用 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.抱歉,如果答案难以阅读,我正在将其上传到手机中。

// SET A CONNECTION WITH THE EXCEL FILE. // 设置与 EXCEL 文件的连接。

              OleDbConnection myExcelConn = new OleDbConnection
                  ("Provider=Microsoft.ACE.OLEDB.12.0; " +
                      "Data Source=" + Server.MapPath(".") + "\\" + fileUpload1.FileName +
                      ";Extended Properties='Excel 12.0;HDR=YES'");

Putting Single quote in Extended Properties like Extended Properties ='Excel 12.0:HDR=YES' solved my problem.在扩展属性中放置单引号,如 Extended Properties ='Excel 12.0:HDR=YES' 解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM