Solved

Reading dBase files with attached MDX via ADO.NET

Posted on 2007-04-11
6
2,303 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
View SQL database for NPS accounting 4 20
EF5: Update Model from Database not working 3 83
SSIS Column mapping 5 41
T-sql question 13 32
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…
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
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 …

739 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