Hello Jim,
Thanks for the link, it is an interesting way to access the database!
I did figure out how to access the fox pro version 8.0 database.
I found out that the particular fox databases I was accessing were closed
tables.
// Here is my corrected connection string.
const string connectString = "Provider=VFPOLEDB.1; Data
Source='C:\\MyTestDir';";
// My database connnection
protected OleDbConnection connection = new OleDbConnection();
connection.Open();
// The insertSQL string contains a SQL statement that
// inserts a new row in the source table.
OleDbCommand command = new OleDbCommand("Select * from testfile.dbf");
// Set the Connection to the new OleDbConnection.
command.Connection = connection;
// Get the records from the query.
OleDbDataReader reader = command.ExecuteReader();
So that is how I was able to access the fox database from ADO.Net
[quoted text, click to view] "Jim Rand" wrote:
> Microsoft OLE DB Provider for Visual FoxPro 9.0
>
http://www.microsoft.com/downloads/details.aspx?familyid=e1a87d8f-2d58-491f-a0fa-95a3289c5fd4&displaylang=en >
> Quick Details
> File Name: vfpoledb.exe
> Version: 1.1
> Date Published: 1/5/2006
> Language: English
> Download Size: 2.5 MB
>
>
> Overview
> The Visual FoxPro OLE DB Provider (VfpOleDB.dll) exposes OLE DB interfaces
> that you can use to access Visual FoxPro databases and tables from other
> programming languages and applications. The Visual FoxPro OLE DB Provider is
> supported by OLE DB System Components as provided by MDAC 2.6 or later. The
> requirements to run the Visual FoxPro OLE DB Provider are the same as for
> Visual FoxPro 9.0.
>
> Note: This version of the VFP OLE DB provider is the same version as the one
> included with Visual FoxPro 9.0 SP1
>
> "BartMan" <MaskProg@community.nospam> wrote in message
> news:761428E3-96E5-4E16-AD5E-78EBB5A172A9@microsoft.com...
> > Greetings,
> >
> > I am devleoping a new application in C# which is suppose to perform a look
> > up of some data from a legacy database locally on the machine. The
> > problem
> > is that this data is stored in a Foxpro 8.0 DBF file. It seems like my
> > connection string works, but how do I get access to a specified .dbf file?
> >
> > // Here is my connection string.
> > const string connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
> > Source=C:\\MyTestDir\\;Extended Properties=dBASE IV;User
> > ID=Admin;Password=";
> >
> > // My database connnection
> > protected OleDbConnection connection = new OleDbConnection();
> >
> > connection.Open();
> >
> > // How to get access to a specified dbf file?
> > // The file is located in C:\MyTestDir\testfile.dbf
> > // The following connection string does not work?????
> > const string connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
> > Source=C:\\MyTestDir\\testfile.dbf;Extended Properties=dBASE IV;User
> > ID=Admin;Password=";
> >
> > Since I am not familiar at all with fox databases, I have a feeling it is
> > something simple I have missed. I am currently using visual studio 2005,
> > on
> > a windows xp sp2 computer.
> >
> > Thanks for any suggestions!
> >
>
>
[quoted text, click to view] > Happy to help. By the way, what are "closed tables"?
Sorry it was a typo, I should have said non contained tables.
For example of container file:
strConnect = _T("Provider=vfpoledb;"
"Data Source=C:\\DatabasePath\\MyDatabase.dbc;");
I am not a fox pro expert, since this is my first experiance with it, but I
think it is a container for the tables.
I was trying to link to my .dbf directly as below, but instead I found out a
..dbf file is a table name instead.
(example of what didn't work)
strConnect = _T("Provider=vfpoledb;"
"Data Source=C:\\DatabasePath\\MyTable.dbf;");
Thanks again for your help!