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

  • Thread starter Thread starter Tony
  • Start date Start date
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
 
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
 
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.
 
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
 
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.
 
ODBC requires a driver to be installed also - appears to be the same issue.
Thanks for the info.
Tony
 
Back
Top