I am trying to read and write dBase files via ADO.NET. The following code is able to open and read a dBase database if the MDX file is NOT present but always fails if the file is present. I have tried numerous combinations of OLE DB, ODBC, drivers, providers, etc. that are part of the standard .NET package but none of them seem to able to work in the presence of the MDX files.
How does one work with indexed dBase files in ADO.NET? [The documentation et al that I have found online suggests that the VFP driver is the most compliant when it comes to dBase formats.]
string path = @"valid db directory"; string cs = "Provider=VFPOLEDB.1;Data Source="+path+";Extended Properties=dBase 5.0"; OleDbConnection conn = new OleDbConnection(cs); conn.Open(); string sql = @"SELECT * FROM DBFTABLE"; OleDbCommand cmd = new OleDbCommand(sql, conn); OleDbDataAdapter da = new OleDbDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); // error occurs at this location - usually an "expected error" but varies somewhat with the driver, protocol, etc. The code shown here produces a "is not a table" error if the MDX file is present.
I do not know the originating tool that created the DBF files (the files are part of a third party package). Does anyone have the file format for the MDX files? (maybe the MDX is in a non-standard or incorrect format - maybe I can determine the creating tool from the MDX format and/or find a workaround for the stadard tools)
|