提示:
实时错误'-2147217887(80040e21)';
ODBC 驱动程序不支持被需要的属性.我的代码:
Option Explicit
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Private Sub connectbt_Click()
Dim strSQL As String
Conn.ConnectionString = "provider=msdasql;DRIVER=Microsoft Visual FoxPro Driver;UID=;Deleted=yes;Null=no;Collate=Machine;BackgroundFetch=no;Exclusive=No;SourceType=DBF;SourceDB=E:\vb\barcode;"
Conn.Open
strSQL = "select * from styles"
Rs.Open strSQL, Conn, adOpenDynamic, adLockOptimistic
Text1.Text = Rs(0)
Text2.Text = Rs(1)
End Sub
实时错误'-2147217887(80040e21)';
ODBC 驱动程序不支持被需要的属性.我的代码:
Option Explicit
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Private Sub connectbt_Click()
Dim strSQL As String
Conn.ConnectionString = "provider=msdasql;DRIVER=Microsoft Visual FoxPro Driver;UID=;Deleted=yes;Null=no;Collate=Machine;BackgroundFetch=no;Exclusive=No;SourceType=DBF;SourceDB=E:\vb\barcode;"
Conn.Open
strSQL = "select * from styles"
Rs.Open strSQL, Conn, adOpenDynamic, adLockOptimistic
Text1.Text = Rs(0)
Text2.Text = Rs(1)
End Sub
ODBC
你的连接字符有问题,参考下面的连接 standard:"Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=c:\mydbpath;" OLE DB, OleDbConnection (.NET)
standard:"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\folder;Extended Properties=dBASE IV;User ID=Admin;Password="
"Persist Security Info=False; " & _
"Driver={Microsoft Visual FoxPro Driver}; " & _
"SourceDB=E:\vb\barcode\;" & _
"SourceType=DBF;" & _
"Exclusive=No;"注意:
SourceDB=E:\vb\barcode\;
rs.open strsql,conn,adopenkeyset,adlockreadonly
删除RS定义,重新引用ADO,再定义RS
~~~~呵呵!!