Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO-Dbase-What is needed to connect to a dbf

Status
Not open for further replies.

BlackKnight

Programmer
Oct 18, 2000
348
US
Hi,

I am using VB6 and ADO to try to connect to a dbase file. I have included the ADO reference in my VB project. I am using the correct connection string (took it from here), my dbf file is where it supposed to be but I receive a driver error. I have connected to Access and SQL Server DBs using ADO without a problem but I can't get Dbase files to work.

What do I need to have "installed": ISAM drivers, create a datalink, ODBC data source, file dsn? I am using a standalone PC. The DB is on the same local machine. (nothing fancy)

Have a good one!
BK
 
Check here for sample connection strings:



Mark


A molehill man is a pseudo-busy executive who comes to work at 9 AM and finds a molehill on his desk. He has until 5 PM to make this molehill into a mountain. An accomplished molehill man will often have his mountain finished before lunch
- Fred Allen
 
Hi,

Thx for the reply. Unfortunately, you never answered the question or maybe never read it. <g>

Not reading the specs is the bane of a programnmer's existence. <g>

Have a good one!
BK
 
Microsoft doesn't provide an OLE DB provider for dBase as far as I know. Googling doesn't show much, either. So, you have to use the OLE DB provider for ODBC and get at dBase files that way, or maybe find a third party vendor that has one (NOOOOOOOO!!!!!! ANYTHING BUT THAT!!!!!!)

A good way to find connection strings is to use the Data Environment. Add one to a project. Set the properties for Connection1 (you can rename it of course). On the Provider tab, set the provider to OLE DB Provider for ODBC. On the connection tab, select Use data source name and select dbase files from the list box. In the Initial catalog box, type in the path name and dbf file. Test the connection. Then, right click on the connection1 and select add command. On the command1's properties, select table for connection object, and find a nice table. Now, go to your form, add a command button, and put in the following code.

Private Sub Command1_Click()
Debug.Print DataEnvironment1.Connection1.ConnectionString
With DataEnvironment1.rsCommand1
.Open
Debug.Print .Fields(0).Name
End With
End Sub

It will print out your connectionstring and also the name of the first field in the table.

This is a cool way to find connection strings.

The connection string I got from this was:

Provider=MSDASQL.1;Persist Security Info=False;Data Source=dBASE Files;Initial Catalog=[MyPath]\db

As you probably know, ISAM databases that use separate files for each table just need to have a path and db in them, rather than a file name like Access would need to have.

Bob Rodes

 
Hi,

Thx for the info. It didn't work but it's not important. Moving on to more important things...<g>

Have a good one!
BK
 
Well, it worked for me!! Perhaps we can drink a bottle of wine and troubleshoot it someday....Not! :)

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top