找不到可安装的 ISAM

发布于 2024-10-03 07:23:02 字数 554 浏览 6 评论 0原文

我有以下代码:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

苏辞 2024-10-10 07:23:02

我有同样的错误,但上面的建议都不起作用。就我而言,我所要做的就是将连接字符串更改为:

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

注意扩展属性属性周围的单引号('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:

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;'). Once I added those single quotes the error disappeared!

听风吹 2024-10-10 07:23:02

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 not Any CPU:

alt text

幻想少年梦 2024-10-10 07:23:02

我在尝试使用更新的提供商打开 xls 文件时遇到此问题。
我通过将扩展属性从更改为“我猜 Excel 11 需要 xlsx 样式文件”来解决此

Extended Properties="Excel 11.0;"

问题

Extended Properties="Excel 8.0;"

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

Extended Properties="Excel 11.0;"

to

Extended Properties="Excel 8.0;"

I guess Excel 11 expects an xlsx style file.

走过海棠暮 2024-10-10 07:23:02

在 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.

何以心动 2024-10-10 07:23:02

使用扩展属性=“\excel 8.0;”

use Extended properties="\excel 8.0;

去了角落 2024-10-10 07:23:02

我有同样的问题。我使用的是 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.

如果没有 2024-10-10 07:23:02

// 设置与 Excel 文件的连接。

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

在扩展属性中添加单引号,例如
扩展属性 ='Excel 12.0:HDR=YES' 解决了我的问题。

// SET A CONNECTION WITH THE EXCEL FILE.

              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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文