Private Sub Command1_Click()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim connstr As String
Dim sql As String
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\2.mdb;"
conn.Open constr
sql = "select * from 认定 where nno='" & Text1.Text & "'"
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
Text2.Text = sql
If Not rs.EOF Then
Text2.Text = rs.Fields("nid")
Else
MsgBox "数据不存在!"
End If
rs.Close
conn.Close
End Sub
vb 连接 access
最新推荐文章于 2021-08-06 11:50:48 发布