Connecting to a FoxPro Database

CoolWriter

New member
Joined
Jul 4, 2003
Messages
3
Hi,

I know how to connect an Access database but I dont know how to connect a FoxPro database. What is the syntax for that?

Thanks...
 
Dim directory as string
dim cnn as new adodb.connection
dim rs as new adodb.recordset

Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset

directory = "C:\Database"
cnn.Open "Driver={Microsoft Visual FoxPro Driver}; SourceType=DBF;" & _
"SourceDB=" & directory & "; Exclusive=No;"

rs.Open "DB.dbf", cnn, adOpenStatic, adLockPessimistic, adcmdtable

(or if you want to use SQL instruction...)
dim sql as string
sql = "SELECT * FROM DB"

rs.Open SQL, cnn, adOpenStatic, adLockPessimistic

E
 
Back
Top