Solved

Reading dBase files with attached MDX via ADO.NET

Posted on 2007-04-11
6
2,317 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 12

Expert Comment

by:Bob Lamberson
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:Bob Lamberson
ID: 21227335
0

Featured Post

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!

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
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 …
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…

623 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