PC Review


Reply
Thread Tools Rate Thread

Connect to Foxpro Data (*.DBF) in VB.Net

 
 
=?Utf-8?B?RXJpY0x1bg==?=
Guest
Posts: n/a
 
      3rd Jan 2006
Dear All

We are currently write a program to "Transfer" Data from old system.

How can i connect to a set of DBF files by
What is the connection string to connect the DBF?
I have try this one but error.
connstr = "Provider = VFPOLEDB;Data Source=" & "C:\ESS2001\DATA\"

I have the following question?
1. Does [OleDBConnection] Object support DBF Files? or i should use
[ODBCConnection] ?
2. Should I it a must to have a "*.dbc" file ?
3. I need to use ADO instead of ADO.Net in VB.Net ?

Thank you for your help in advance!

--
EricLun
 
Reply With Quote
 
 
 
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      3rd Jan 2006
Eric,

She will answer you probably as well. It seems she is busy again in this
newsgroups.

However if not, have a look at these ansered messages.

http://groups.google.com/group/micro...rch+this+group

I hope this helps,

Cor


 
Reply With Quote
 
Cindy Winegarden
Guest
Posts: n/a
 
      3rd Jan 2006
Hi Eric,

First of all, be sure you have the latest FoxPro and Visual FoxPro OLE DB
data provider, available from msdn.microsoft.com/vfoxpro/downloads/updates.
ODBC is an older technology and does not support all versions of FoxPro
tables.

FoxPro tables come in 3 parts: the DBF is the main table, the FPT (optional)
is the contents of Memo fields, and the CDX (also optional) is the
associated index file. All three of these generally named the same excepting
the extension and if your table has Memo fields and indexes then the FPT and
CDX must be present.

There are two ways Fox tables are organized. First, there are "free" tables.
With free tables a DBC file is not present and the connection string should
reference only the directory where the files are found, as you have done
below.

Second, Fox tables can be associated with a "Database Container" (DBC, DCT
memo, and DCX index files) which contains metadata about the tables and
other features such as stored procedures and triggers. If a DBC is present
the path in your connection string should be something like
"C:\ESS2001\DATA\Whatever.dbc" .

You can use the same types of ADO.NET code for Fox tables as you would for
any other OLE DB-compliant data source.


--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
(E-Mail Removed) www.cindywinegarden.com


"EricLun" <(E-Mail Removed)> wrote in message
news:127B59E8-4035-47DD-8C60-(E-Mail Removed)...

> How can i connect to a set of DBF files by
> What is the connection string to connect the DBF?
> I have try this one but error.
> connstr = "Provider = VFPOLEDB;Data Source=" & "C:\ESS2001\DATA\"
>
> I have the following question?
> 1. Does [OleDBConnection] Object support DBF Files? or i should use
> [ODBCConnection] ?
> 2. Should I it a must to have a "*.dbc" file ?
> 3. I need to use ADO instead of ADO.Net in VB.Net ?



 
Reply With Quote
 
Cindy Winegarden
Guest
Posts: n/a
 
      3rd Jan 2006
Hi Cor,

Thanks! :-)

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
(E-Mail Removed) www.cindywinegarden.com


"Cor Ligthert [MVP]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Eric,
>
> She will answer you probably as well. It seems she is busy again in this
> newsgroups.
>
> However if not, have a look at these ansered messages.
>
> http://groups.google.com/group/micro...rch+this+group
>
> I hope this helps,
>
> Cor
>



 
Reply With Quote
 
Paul Clement
Guest
Posts: n/a
 
      3rd Jan 2006
On Tue, 3 Jan 2006 00:52:02 -0800, "EricLun" <(E-Mail Removed)> wrote:

¤ Dear All
¤
¤ We are currently write a program to "Transfer" Data from old system.
¤
¤ How can i connect to a set of DBF files by
¤ What is the connection string to connect the DBF?
¤ I have try this one but error.
¤ connstr = "Provider = VFPOLEDB;Data Source=" & "C:\ESS2001\DATA\"
¤

What is the name of your database? I don't see it in the connection string.

¤ I have the following question?
¤ 1. Does [OleDBConnection] Object support DBF Files? or i should use
¤ [ODBCConnection] ?

Yes. No don't use ODBC. Those drivers are outdated.

¤ 2. Should I it a must to have a "*.dbc" file ?

I believe that would be required by the OLEDB provider, yes.

¤ 3. I need to use ADO instead of ADO.Net in VB.Net ?

No, you can use ADO.NET.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Reply With Quote
 
Cindy Winegarden
Guest
Posts: n/a
 
      3rd Jan 2006
Hi Paul,

See my post in this thread for a little discussion of working with Fox data
in .NET. :-)

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
(E-Mail Removed) www.cindywinegarden.com


"Paul Clement" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> ¤ connstr = "Provider = VFPOLEDB;Data Source=" & "C:\ESS2001\DATA\"
> What is the name of your database? I don't see it in the connection
> string.


> ¤ 2. Should I it a must to have a "*.dbc" file ?
> I believe that would be required by the OLEDB provider, yes.



 
Reply With Quote
 
=?Utf-8?B?RXJpY0x1bg==?=
Guest
Posts: n/a
 
      4th Jan 2006
Hi Cindy,

I have fixed my problem after i download the
OleDB Provider for VFP 9.0 in Microsoft Site

http://www.microsoft.com/downloads/d...DisplayLang=en

My Connection String as follow is workable
"Provider = VFPOLEDB;Data Source=C:\DBFPath\To_eric;Mode=Read;Collating
Sequence=MACHINE;"

I am using "Free Table" method as my user would like to choose where even
"DBF" file they need.

Thank you for you and other help.

--
EricLun


"Cindy Winegarden" wrote:

> Hi Eric,
>
> First of all, be sure you have the latest FoxPro and Visual FoxPro OLE DB
> data provider, available from msdn.microsoft.com/vfoxpro/downloads/updates.
> ODBC is an older technology and does not support all versions of FoxPro
> tables.
>
> FoxPro tables come in 3 parts: the DBF is the main table, the FPT (optional)
> is the contents of Memo fields, and the CDX (also optional) is the
> associated index file. All three of these generally named the same excepting
> the extension and if your table has Memo fields and indexes then the FPT and
> CDX must be present.
>
> There are two ways Fox tables are organized. First, there are "free" tables.
> With free tables a DBC file is not present and the connection string should
> reference only the directory where the files are found, as you have done
> below.
>
> Second, Fox tables can be associated with a "Database Container" (DBC, DCT
> memo, and DCX index files) which contains metadata about the tables and
> other features such as stored procedures and triggers. If a DBC is present
> the path in your connection string should be something like
> "C:\ESS2001\DATA\Whatever.dbc" .
>
> You can use the same types of ADO.NET code for Fox tables as you would for
> any other OLE DB-compliant data source.
>
>
> --
> Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
> (E-Mail Removed) www.cindywinegarden.com
>
>
> "EricLun" <(E-Mail Removed)> wrote in message
> news:127B59E8-4035-47DD-8C60-(E-Mail Removed)...
>
> > How can i connect to a set of DBF files by
> > What is the connection string to connect the DBF?
> > I have try this one but error.
> > connstr = "Provider = VFPOLEDB;Data Source=" & "C:\ESS2001\DATA\"
> >
> > I have the following question?
> > 1. Does [OleDBConnection] Object support DBF Files? or i should use
> > [ODBCConnection] ?
> > 2. Should I it a must to have a "*.dbc" file ?
> > 3. I need to use ADO instead of ADO.Net in VB.Net ?

>
>
>

 
Reply With Quote
 
Cindy Winegarden
Guest
Posts: n/a
 
      4th Jan 2006
Hi Eric,

Just to be clear, if a DBC file is present you should assume all the tables
in that directory belong to it (although they don't have to) and connect to
the DBC. The Fox data engine uses the metadata in the DBC to find the tables
you reference in your app.

If there is no DBC then the tables are most likely free tables. I say "most
likely" because the DBC is not required to be in the same directory as the
DBFs. Also, if the tables have been copied from one directory to another the
DBC may not have been included in the copying. This would, of course, cause
problems.

Free tables and tables belonging to a DBC can be mixed in the same
directory. However, with a free table directory connection the tables
contained by the DBC will not be recognized, and with a connection to the
DBC, any free tables in that directory will not be recognized.

This probably way overcomplicates your situation but I thought I'd discuss
it, since someone searching the archives may need to know these details.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
(E-Mail Removed) www.cindywinegarden.com


"EricLun" <(E-Mail Removed)> wrote in message
news:AFACE1BA-1D55-43B2-95EE-(E-Mail Removed)...

> I am using "Free Table" method as my user would like to choose where even
> "DBF" file they need.




 
Reply With Quote
 
=?Utf-8?B?RXJpY0x1bg==?=
Guest
Posts: n/a
 
      4th Jan 2006
I got it! Thank you very much
--
EricLun


"Cindy Winegarden" wrote:

> Hi Eric,
>
> Just to be clear, if a DBC file is present you should assume all the tables
> in that directory belong to it (although they don't have to) and connect to
> the DBC. The Fox data engine uses the metadata in the DBC to find the tables
> you reference in your app.
>
> If there is no DBC then the tables are most likely free tables. I say "most
> likely" because the DBC is not required to be in the same directory as the
> DBFs. Also, if the tables have been copied from one directory to another the
> DBC may not have been included in the copying. This would, of course, cause
> problems.
>
> Free tables and tables belonging to a DBC can be mixed in the same
> directory. However, with a free table directory connection the tables
> contained by the DBC will not be recognized, and with a connection to the
> DBC, any free tables in that directory will not be recognized.
>
> This probably way overcomplicates your situation but I thought I'd discuss
> it, since someone searching the archives may need to know these details.
>
> --
> Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
> (E-Mail Removed) www.cindywinegarden.com
>
>
> "EricLun" <(E-Mail Removed)> wrote in message
> news:AFACE1BA-1D55-43B2-95EE-(E-Mail Removed)...
>
> > I am using "Free Table" method as my user would like to choose where even
> > "DBF" file they need.

>
>
>
>

 
Reply With Quote
 
Paul Clement
Guest
Posts: n/a
 
      4th Jan 2006
On Tue, 3 Jan 2006 14:17:18 -0500, "Cindy Winegarden" <(E-Mail Removed)> wrote:

¤ Hi Paul,
¤
¤ See my post in this thread for a little discussion of working with Fox data
¤ in .NET. :-)

Hi Cindy,

Hey, I didn't do too bad for not being a FoxPro expert. ;-)


Paul
~~~~
Microsoft MVP (Visual Basic)
 
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
using UDL to connect to Foxpro database imad koussa Microsoft Excel Discussion 0 26th Apr 2008 04:36 PM
How do I connect to a FoxPro 6 .dbf file using OleDb? Tony Microsoft ADO .NET 7 2nd Aug 2005 09:23 PM
How to connect to foxpro database? =?Utf-8?B?S2ltbw==?= Microsoft Dot NET 4 20th May 2004 04:36 AM
Re: Connect to Visual FoxPro Sorin Sandu Microsoft ADO .NET 0 19th May 2004 05:16 AM
Connect to Visual FoxPro Sorin Sandu Microsoft ADO .NET 1 18th May 2004 02:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:59 AM.