dim conn As New ADODB.Connection
dim ConnString As String
dim sql as string
Dim rs As New ADODB.Recordset
ConnString = "provider=microsoft.jet.oledb.4.0;" & _
"data source=" & App.Path & "\数据库名.mdb;Jet OLEDB:Database Password=数据库密码"
If conn.state <> 1 Then
conn.Open (ConnString)
End If
sql="select * from 表名 where 关键字段名='" & Text8.Text & "'"
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
text9.text=rs.rs.Fields(ID)