PC Review


Reply
Thread Tools Rate Thread

ADO.Net and FoxPro 8 dbf file

 
 
=?Utf-8?B?QmFydE1hbg==?=
Guest
Posts: n/a
 
      30th Aug 2007
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!

 
Reply With Quote
 
 
 
 
Jim Rand
Guest
Posts: n/a
 
      30th Aug 2007
Microsoft OLE DB Provider for Visual FoxPro 9.0
http://www.microsoft.com/downloads/d...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" <(E-Mail Removed)> wrote in message
news:761428E3-96E5-4E16-AD5E-(E-Mail Removed)...
> 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!
>



 
Reply With Quote
 
=?Utf-8?B?QmFydE1hbg==?=
Guest
Posts: n/a
 
      30th Aug 2007
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

"Jim Rand" wrote:

> Microsoft OLE DB Provider for Visual FoxPro 9.0
> http://www.microsoft.com/downloads/d...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" <(E-Mail Removed)> wrote in message
> news:761428E3-96E5-4E16-AD5E-(E-Mail Removed)...
> > 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!
> >

>
>
>

 
Reply With Quote
 
Jim Rand
Guest
Posts: n/a
 
      30th Aug 2007
Happy to help. By the way, what are "closed tables"?

Jim

"BartMan" <(E-Mail Removed)> wrote in message
news:26472949-6EFA-4E56-A1B7-(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
=?Utf-8?B?QmFydE1hbg==?=
Guest
Posts: n/a
 
      30th Aug 2007
> 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!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to convert excell file into dbf for foxpro agnelo rodrigues Microsoft Excel Misc 2 3rd Apr 2008 10:38 PM
Export File To FoxPro DBF? Wilson Pye Microsoft Outlook 1 9th Jan 2006 07:07 PM
Connecting to a FoxPro DBF file Steve Roberts Microsoft Access ADP SQL Server 3 13th Oct 2005 04:21 PM
Update Foxpro (DB4) File Soniya Microsoft Excel Programming 1 8th Mar 2004 01:07 PM
Foxpro DBF File import to Access: Index file not found lalexander Microsoft Access 0 22nd Jan 2004 08:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:30 AM.