Solved

Reading dBase files with attached MDX via ADO.NET

Posted on 2007-04-11
6
2,271 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now