DataGrid是数据显示的控件,不管数据存储,需要与数据存储体一起使用
Private Sub cmd_query_Click()
On Error Resume Next
Set rs = New ADODB.Recordset
Dim strs As String
cmd_query.Enabled = False
Dim i As Integer
i = 0
Set DataGrid1.DataSource = Adodc2
If Combo2.ListIndex = 0 Then
If Not IsNumeric(cmd_con.Text) Then
MsgBox "请输入编号"
GoTo qend
End If
strs = "select * from " & qtable & " where 编号=" & cmd_con.Text
Else
strs = "select * from " & qtable & " where 内容 like '%" & cmd_con.Text & "%'"
End If
If cmd_con.Text <> "" Then
'rs.Open strs, conn, adOpenDynamic, adLockPessimistic
'rs.Open strs, conn, adOpenStatic, adLockOptimistic