开发者

ASP.NET: "Could not find installable ISAM" exception when trying to read dBASE IV file

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 i开发者_运维知识库f you need any more information. Thanks for your help.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜