ADO+ACCESS+DATAGRID显示查找结果
Private Sub cmdFind_Click()
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim Str1 As String
Dim Str2 As String
Dim Str3 As String
Dim Combotxt As String
Dim Txt As String
Combotxt = Combo1.Text
Txt = Text1.Text
Str1 = "Provider=Microsoft.Jet.OLEDB.4.0;"
Str2 = "Data Source=C:\Users\sAnKes\Desktop\data.mdb;"
Str3 = "Jet OLEDB:Database Password="
conn.Open Str1 & Str2 & Str3
rs.Open "select * from " & Combotxt & " where" & Txt, con, adOpenKeyset, adLockOptimistic
Set DataGrid1.DataSource = rs
End Sub
查询结果在dataguid中显示。可是经多次测试都不行。望指教!