Solved

Reading dBase files with attached MDX via ADO.NET

Posted on 2007-04-11
6
2,284 Views
Last Modified: 2013-11-24
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)
0
Comment
Question by:RobMinnis
6 Comments
 
LVL 1

Expert Comment

by:fjh_muc
ID: 18897926
.MDX (multiple index) is usually only created and used by the original dBASE product.
There should be an ODBC driver available by DataDirect.

http://www.dbase.com/default.asp
0
 

Author Comment

by:RobMinnis
ID: 18958832
I had no luck with dBase (no ODBC or OLEDB driver that I could find and no response from their tech support).  However, I was able to use CodeBase.  They claim to have an ODBC driver but it is part of the more expensive package.  So, for this project, I'm using their proprietary API.
0
 

Author Comment

by:RobMinnis
ID: 18958846
Moderator:  How do I end this question without accepting a solution?
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 12

Expert Comment

by:BobLamberson
ID: 19046551
Rob you might try using DAO to open the dbf then convert the data types to ADO.
The problem is that ADO doesn't know how to handle the data types in the dbf. I once solved this problem with a legacy dBase / Clipper application that we rewrote in vb6 using ADO.
If it is an older dbf, which the MDX indicates, this will probably work. The MDX file is an index and won't affect the content of the data in the dbf.
0
 
LVL 1

Accepted Solution

by:
pcurtis_expert earned 500 total points
ID: 21222725
http://www.vistasoftware.com/default.asp
Try the link above.  They have a 30 day free trial.
0
 
LVL 12

Expert Comment

by:BobLamberson
ID: 21227335
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question