Private Sub Command1_Click()
Dim temp As String
If Trim(Text1.Text) <> "" Then
temp = "trim(text1.text)"
Else
temp = ""
End If
If temp <> "" Then
temp = temp And "trim(text2.text)"
Else
temp = "trim(text2.text)"
End If
If temp <> "" Then
temp = temp And "trim(Combobox.text)"
Else
temp = "trim(Combobox.text)"
End If
If temp <> "" Then
temp = temp And "trim(text3.text)"
Else
temp = "trim(text3.text)"
End If
If temp = "" Then
Sql = "select * from infor "
AdoRs.CursorLocation = adUseClient
AdoRs.Open Sql, StrConn1, adOpenStatic, adLockReadOnly
Set DataGrid1.DataSource = AdoRs
DataGrid1.ReBind
DataGrid1.Refresh
Frame4.Refresh
Else
Sql = "select * from infor where " & temp & ""
AdoRs.CursorLocation = adUseClient
AdoRs.Open Sql, StrConn1, adOpenStatic, adLockReadOnly
Set DataGrid1.DataSource = AdoRs
DataGrid1.ReBind
DataGrid1.Refresh
End If
end sub
Dim temp As String
If Trim(Text1.Text) <> "" Then
temp = "trim(text1.text)"
Else
temp = ""
End If
If temp <> "" Then
temp = temp And "trim(text2.text)"
Else
temp = "trim(text2.text)"
End If
If temp <> "" Then
temp = temp And "trim(Combobox.text)"
Else
temp = "trim(Combobox.text)"
End If
If temp <> "" Then
temp = temp And "trim(text3.text)"
Else
temp = "trim(text3.text)"
End If
If temp = "" Then
Sql = "select * from infor "
AdoRs.CursorLocation = adUseClient
AdoRs.Open Sql, StrConn1, adOpenStatic, adLockReadOnly
Set DataGrid1.DataSource = AdoRs
DataGrid1.ReBind
DataGrid1.Refresh
Frame4.Refresh
Else
Sql = "select * from infor where " & temp & ""
AdoRs.CursorLocation = adUseClient
AdoRs.Open Sql, StrConn1, adOpenStatic, adLockReadOnly
Set DataGrid1.DataSource = AdoRs
DataGrid1.ReBind
DataGrid1.Refresh
End If
end sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货