How do I connect to a FoxPro 6 .dbf file using OleDb?

T

Tony

Does anyone know how to simply connect to a FoxPro 6 .dbf file using
ADO.NET's OleDb provider so I can query the data?
Mainly I need to know what the connection string is so I can execute a
query.

Thanks,
Tony
 
R

Robbe Morris [C# MVP]

I'm not 100% sure this will work with OleDb. However,
it is a valid connection string for classic ADO 2.6 and higher.

oADOCon.Open "DBQ=c:\temp;" _
& "Driver={Microsoft dBase Driver (*.dbf)};" _
& "DriverId=277;FIL=dBase4.0"

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp
 
C

Cindy Winegarden

Hi Tony,

Download the latest FoxPro and Visual FoxPro OLE DB data provider from
msdn.microsoft.com/vfoxpro/downloads/updates.

The minimum connection string is

' For Visual FoxPro "free" tables
strConn = "Provider=VFPOLEDB.1;Data Source=C:\;"

' For a Visual FoxPro Database Container
' (a DBC file is present)
strConn = "Provider=VFPOLEDB.1;Data Source=C:\MyDBC.dbc;"

Post back if you can't figure it out from there.
 
T

Tony

I tried the OleDb provider you suggested and it worked fine. Thanks for the
info.

BUT, I would rather be able to access the table via Jet if at all possible,
since installing the OleDb driver requires admin privileges on the client
machine and you know those corporate IT Nazi's when it comes to installing
anything on a client machine...!

Is there another option?

Tony
 
C

Cindy Winegarden

Hi Tony,

The only other alternative is ODBC (downloadable from the same location).
Jet will not work with the new data features added in Visual FoxPro.
 
T

Tony

ODBC requires a driver to be installed also - appears to be the same issue.
Thanks for the info.
Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top