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!

Recordset syntax for FoxPro while using ADODB..

Status
Not open for further replies.
Oct 22, 2001
215
US
Hi,
I got the connection working but could not open the record set... I know I should not use the file name for source rather jus path for opening a new connection.. but how does the recordset work? Here is my code. Thanks.

'path_fox is the path of my data file
connStr = "Driver=Microsoft Visual Foxpro Driver; " + _
"UID=;SourceType=DBF; SourceDB = " + path_fox

cnDb.Open connStr
cnDb.CommandTimeout = 0
Set rsDb = New ADODB.Recordset
With rsDb
.ActiveConnection = cnDb
.Source = path_fox
'I get error when I try to open this :
.Open
 
Just a quick guess:

The connection string is very sensitive to spaces. Make sure they are omitted, such as in "SourceDB = ".

I've never seen connection coding using a "With" statement. Not that it wouldn't make sense, though. Try coding without it and let us know.

 
Thanks to all. It is working for me now.
All I was missing an SQL statement. The connection string should be some thing like this:

With rsDb
.Source = "SELECT * FROM tableName"
.ActiveConnection = cnDb
.Open

Happy Holiday@
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top