ASP.NET:“找不到可安装的 ISAM”尝试读取 dBASE IV 文件时出现异常

发布于 2024-09-16 03:27:46 字数 640 浏览 9 评论 0原文

我需要在 ASP.NET 应用程序中打开并读取 Dbase 文件。当我尝试打开连接时,出现异常“无法找到可安装的 ISAM”。我已经尝试了这个问题中的最佳答案中的解决方案,但他们确实不适合我。

数据文件的文件路径是C:\dev\DATA.DBF。这是我用来尝试打开连接的代码:

Dim connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\dev\DATA.DBF;Extended Properties=dBASE IV;"
Dim connection As OleDbConnection = New OleDbConnection(connectionString)
connection.Open()

此时我收到异常“无法找到可安装的 ISAM”。你有什么想法我可以尝试让它发挥作用吗?请注意,我可以将此文件作为 dBASE IV 文件导入到 Access 数据库中。

我在 Windows 7 上运行 Visual Studio 2008。如果您需要更多信息,请告诉我。感谢您的帮助。

I need to open and read a Dbase file in my ASP.NET application. When I try to open the connection, I am getting the exception "Could not find installable ISAM." I have tried the solutions in the top answer in this question, but they did not work for me.

The filepath of the data file is C:\dev\DATA.DBF. Here is the code I am using to try to open the connection:

Dim connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\dev\DATA.DBF;Extended Properties=dBASE IV;"
Dim connection As OleDbConnection = New OleDbConnection(connectionString)
connection.Open()

At this point I get the exception "Could not find installable ISAM." Do you have any ideas what I can try to get this to work? Note that I am able to import this file into an Access database as a dBASE IV file.

I am running Visual Studio 2008 on Windows 7. Let me know if you need any more information. Thanks for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

暖阳 2024-09-23 03:27:46

我已经找到了解决这个问题的方法。我使用了这篇文章中概述的技术。

我使用 ODBC 连接而不是 OLE 连接。代码如下:

Dim connectionString = "Driver={Microsoft dBase Driver (*.dbf)};SourceType=DBF;SourceDB=C:\dev;Exclusive=No; Collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO;"
Dim connection As OdbcConnection = New OdbcConnnection(connectionString)
Dim command As OdbcCommand = New OdbcCommand("SELECT * FROM C:\dev\DATA.DBF", connection)
connection.Open()
Dim reader As OdbcDataReader = command.ExecuteReader()
connection.Close()

请注意,DBF 文件的目录名位于连接字符串中,而 DBF 文件的完整路径位于 select 语句中。我只是遵循链接帖子中的约定,它对我有用。

I have found a solution to this problem. I used the technique outlined in this post.

I am using an ODBC connection instead of an OLE connection. Here is the code:

Dim connectionString = "Driver={Microsoft dBase Driver (*.dbf)};SourceType=DBF;SourceDB=C:\dev;Exclusive=No; Collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO;"
Dim connection As OdbcConnection = New OdbcConnnection(connectionString)
Dim command As OdbcCommand = New OdbcCommand("SELECT * FROM C:\dev\DATA.DBF", connection)
connection.Open()
Dim reader As OdbcDataReader = command.ExecuteReader()
connection.Close()

Note that the directory name of the DBF file is in the connection string, while the full path of the DBF file is in the select statement. I simply followed the convention in the linked post, and it worked for me.

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