vb中实现对两个字段均可查询,代码怎么写?
PrivateSubCommand7_Click()CallLinkDataIfText15.Text<>""ThenSQL="select*from客户信息表where...
Private Sub Command7_Click()
Call LinkData
If Text15.Text <> "" Then
SQL = "select * from 客户信息表 where 客户代码 ='" & Text15.Text & "'"
ElseIf Text15.Text = "" Then
MsgBox "请输入客户代码信息!", vbOKOnly, "提示"
Text15.SetFocus
Exit Sub
End If
rs.CursorLocation = adUseClient
rs.Open SQL, conn, adOpenKeyset, adLockPessimistic
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
If rs.RecordCount = 0 Then
MsgBox "查询不到该信息!", vbOKOnly, "提示"
Text15.Text = ""
Else
Set DataGrid1.DataSource = rs
End If
end sub
这是查询一个的,加一个客户信息text实现输入两个中任意一个text都能查询到表中内容,怎么修改代码? 展开
Call LinkData
If Text15.Text <> "" Then
SQL = "select * from 客户信息表 where 客户代码 ='" & Text15.Text & "'"
ElseIf Text15.Text = "" Then
MsgBox "请输入客户代码信息!", vbOKOnly, "提示"
Text15.SetFocus
Exit Sub
End If
rs.CursorLocation = adUseClient
rs.Open SQL, conn, adOpenKeyset, adLockPessimistic
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
If rs.RecordCount = 0 Then
MsgBox "查询不到该信息!", vbOKOnly, "提示"
Text15.Text = ""
Else
Set DataGrid1.DataSource = rs
End If
end sub
这是查询一个的,加一个客户信息text实现输入两个中任意一个text都能查询到表中内容,怎么修改代码? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询