Link to home
Start Free TrialLog in
Avatar of Eduardo Fuerte
Eduardo FuerteFlag for Brazil

asked on

How to obtain VFP OLEDB string connection to use in code?

Hi Experts!

I'm adapting a C# application to read .DBF tables. This application uses OLEDB

I already installed OLEDB for VFP but I have no idea on how to obtain the  code similar to that bellow, to fit my needs.

   oConn.ConnectionString =   @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\dados;Extended Properties=dBASE IV;";

Open in new window


Thanks in advance!
Avatar of Rgonzo1971
Rgonzo1971

Hi,

pls try
Provider=vfpoledb;Data Source=C:\MyDataDirectory\MyTable.dbf;
Collating Sequence=machine;

Open in new window


for reference
https://www.connectionstrings.com/vfp-ole-db-provider/

Regards
Avatar of Eduardo Fuerte

ASKER

Hi

I guess what you pointed it's the correct way, maybe something else is needed since when running this error, related to register, occurs:
User generated image
The OLEDB was installed through the msi instalator
User generated image
Could you point where to go from here?
Hi,

maybe this one
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\folder;
Extended Properties=dBASE IV;User ID=Admin;Password=;

Open in new window


https://www.connectionstrings.com/microsoft-jet-ole-db-4-0/standard-dbf-foxpro/
While the following is from one of my VB.ASP (not C#) applications, perhaps it can help you figure out the Connection string to use.

Note the below "cDataPath" is replaced with the Path where the VFP data tables reside:
"User ID=;DSN=;Collating Sequence=MACHINE;" & _
                cDataPath & _
                "Provider='VFPOLEDB.1';Cache Authentication=False;Mask Password=False;persist security info=False;Mode=Share Deny None;Extended Properties=;Encrypt Password=False;"

Open in new window


Good Luck
What is the target platform of your C# application? You have to specify 32 bit otherwise you cannot use VFP OLE DB provider.
What is the user running the C# application? It has to be same user for which you've installed the provider. Better choice is to install it for all users maybe.
Hi

I'm using an existing C# application do read DBF files

http://www.macoratti.net/08/08/net_dbf1.htm
Reinstalled to all users.
I guess the major problem here is to make C# app to recognize and link with OLE DB.
I've been asking with no answer:  What is the C# program target platform? Did you compile it for 32 bit environment?

If you've 32 bit C# app which still does not see the OLE DB provider then change the  vfpoledb  to   vfpoledb.1   in your connection string. Also check what registry entries point to vfpoledb.
I'm debbuging it in a 64 bits environment.
VFP OLE DB provider requires 32 bit C# application.
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You program runs perfectly, now it's a matter of adapt the initial one to the features you used.

User generated image
Thanks for so qualified assistance!
You are welcome
Pcelba

I don't know it's a good idea, I started to use VFPToolkit for .Net to complete the task of reading data from DBF  and insert  then into MS-SQLServer tables, so I'm formulating a new question on this subject...