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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC [Visual FoxPro Driver] Syntax error?

Status
Not open for further replies.
Oct 22, 2001
215
0
0
US
Hi,
I am trying to access a foxpro table using ADODB and am getting this error: ODBC Synttax error or Access Violation.

I do have an ODBC driver for this table, and noone else is opening this table. There should not be any access violation but...?
Can any one figure it out what am I doing wrong? TIA. Here is the code...

Set cnDb = New ADODB.Recordset
connStr = "Driver=Microsoft Visual Foxpro Driver; " + _
"UID=;SourceType=DBF; SourceDB = " & "c:\mytest\datafile.dbf"
cnDb.Open connStr

 
Try the following code. You need to open an ADO connection and specify the directory if it is a free table, not the DBF file itself.

cnDb = New ADODB.Connection
connStr = "Driver=Microsoft Visual Foxpro Driver; " + ;
"UID=;SourceType=DBF; SourceDB = " + "c:\"
cnDb.Open connStr

set ors = cnDb.execute("select * from datafile")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top