Hi, I want to retrieve the data from foxpro tables... i already download foxpro driver and installed... i have problem in record sets.. if anyone know post ur comments with examples...
Printable View
Hi, I want to retrieve the data from foxpro tables... i already download foxpro driver and installed... i have problem in record sets.. if anyone know post ur comments with examples...
Moved to Database Development
You need to be more specific. What does "i have problem in record sets" mean? Are you getting errors? If so, what? What code are you running that isn't working for you and what, exactly, is happening when you run it?
Are you connecting to your database without any issue?
This is the connection string coding:
con.Open "DRIVER={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" & App.Path & "\;Exclusive=No;"
I searched google, all of them explained only about connection string..
How to access the table in foxpro? Generally foxpro contains only tables.. maybe it doesn't... i work with dbf file for 1st time....
rs.Open "select * from auay04", con, adOpenDynamic, adLockOptimistic
error: odbc doesnot support this proprty..
correction:
con.Open "DRIVER={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" & App.Path & "\test.dbf;Exclusive=No;"
Ok, I'm still a bit confused.
Are you successfully connecting to the database, or is the connection the real issue?
(Because, if you can't connect properly, there is no way you are going to retrieve anything.)
Connection doesn't show any errors... dbf is a single file or table.. for eg: in access database contains any no of tables.. but in dbf each file is a table.. my problem r as follows,
1. how to connect
2. open tables
Wow, sounds like my environment, to some degree. Can you post up a couple of file names or the files themselves? Ever play around with dynamic data sources?
Something like the following. (Exact VB syntax to be added by you.)
[Edit for readability]Code:Option Explicit
Private Sub MyVFPDBProc()
Dim strFileName As String
Const strMY_PATH As String = "C:\TEMP\"
strFileName = Dir(strMY_PATH & "*.dbf", vbNormal)
Do While Len(strFileName) > 0
con.Open "DRIVER={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" _
& strMY_PATH & strFileName & "\;Exclusive=No;"
'Do work on your connection
'.
'.
' Finish work, close connection
strFileName = Dir
Loop
End Sub
i finished it using visual foxpro oledb driver.. now its working...during the connection we should not mention the file name, only path..
sample:
con.Open "Provider=VFPOLEDB.1;Data Source=" & f & ";Password=;Collating Sequence=MACHINE"
rs.Open "select * from " & tb, con, adOpenDynamic, adLockOptimistic
f-contains the path
tb-contains file name