40

我在 Excel 工作簿中编写了一些 VBA 代码,以从桌面上同一目录中的 Access 数据库中检索数据。它在我的机器和其他几台运行 Windows XP 的机器上运行良好,但是当我们在 Vista 机器上测试它时,我们遇到了以下错误:

找不到可安装的 ISAM

我在网上做了很多搜索,但似乎找不到具体的答案。连接字符串似乎很好,而且,正如我所提到的,它可以在多台机器上运行。

有谁知道是什么原因造成的?我的连接字符串如下:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\ptdb\Program Tracking Database.mdb;

谢谢

4

8 回答 8

77

Extended Properties在:周围放置单引号

OleDbConnection oconn = 
    new OleDbConnection(
        @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1;';");

试试看,确实有效。

于 2012-05-23T05:36:27.937 回答
21

Try putting single quotes around the data source:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source='D:\ptdb\Program Tracking Database.mdb';

The problem tends to be white space which does have meaning to the parser.

If you had other attributes (e.g., Extended Properties), their values may also have to be enclosed in single quotes:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source='D:\ptdb\Program Tracking Database.mdb'; Extended Properties='Excel 8.0;HDR=YES;IMEX=1;';

You could equally well use double quotes; however, you'll probably have to escape them, and I find that more of a Pain In The Algorithm than using singles.

于 2009-02-04T16:44:53.093 回答
3

只需在您的连接字符串中使用 Jet OLEDB:。它为我解决了。

下面是一个例子:

"Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=E:\Database.mdb;Jet OLEDB:Database Password=b10w"
于 2013-04-08T12:25:03.633 回答
0

我刚刚遇到了一个非常相似的问题。

和你一样,我的连接字符串看起来是正确的——事实上,完全相同的连接字符串在其他情况下也能正常工作。

问题原来是缺乏资源。20 次中有 19 次,我会看到“找不到可安装的 ISAM”,但有一两次(根本没有任何代码更改),它会产生“内存不足”。

重新启动机器“解决”了问题(现在......?)。这发生在 Windows XP 上使用 Jet 版本 4.0.9505.0。

于 2009-10-13T22:12:45.393 回答
0

我用它来更新一个 excel 12 xlsx 文件

        System.Data.OleDb.OleDbConnection MyConnection;
        System.Data.OleDb.OleDbCommand myCommand = new System.Data.OleDb.OleDbCommand();
        MyConnection = new System.Data.OleDb.OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0;Data Source='D:\\Programming\\Spreadsheet-Current.xlsx';Extended Properties='Excel 12.0;HDR=YES;';");
        MyConnection.Open();
        myCommand.Connection = MyConnection;
        string sql = "Update [ArticlesV2$] set [ID]='Test' where [ActualPageId]=114";// 
        myCommand.CommandText = sql;
        myCommand.ExecuteNonQuery();
        MyConnection.Close();
于 2015-11-25T21:32:29.260 回答
-1

使用此连接字符串

string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;" +
      "Data Source=" + strFileName + ";" + "Extended Properties=" + "\"" + "Excel 12.0;HDR=YES;" + "\"";
于 2011-10-13T06:09:45.093 回答
-2

This problem is because the machine can't find the the correct ISAM (indexed sequential driver method) registered that Access needs.

It's probably because the machine doesn't have MSACeesss installed? I would make sure you have the latest version of Jet, and if it still doesn't work, find the file Msrd3x40.dll from one of the other machines, copy it somewhere to the Vista machine and call regsvr32 on it (in Admin mode) that should sort it out for you.

于 2009-02-04T16:55:33.790 回答
-2

使用下面的连接字符串从 XLSX 文件中读取:

string ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + <> + ";Extended Properties=Excel 8.0;";

于 2012-11-22T13:07:52.347 回答