I have code below, How I can connect the dbase files (Microsoft visual pro) using ADODB connection? I got the code below but it use microsoft access to connect the database.
Code:
Dim strDB, strConn As String
'Set New connection
Set cnnACC = New ADODB.Connection
'String Database Path
strDB = TextBox1.Text
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDB & ";Persist Security Info=False"
' Open the connection
cnnACC.Open strConn
Why I got that error message? It point me at this line
rst.Open sSQL, cnnACC, adOpenDynamic, adLockOptimistic
My dbf files location is here
D:\Sourcecode\Add table from dbase\table.dbf
Code:
Dim strConn As String
Dim sSQL As String
'Set New connection
Set cnnACC = New ADODB.Connection
Set rst = New ADODB.RecordSet
strConn = "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=D:\Sourcecode\Add table from dbase;"
cnnACC.Open strConn
sSQL = "SELECT * FROM table"
rst.Open sSQL, cnnACC, adOpenDynamic, adLockOptimistic