FROM字句语法错误,求高手帮忙

fufuxt0929 2012-04-24 09:58:14
Private Sub Command1_Click()
Dim strquery As String
Dim wherestr As String
wherestr = ""

If DataCombo1.Text <> "" Then
wherestr = " and 性别='" & DataCombo1.BoundText & "'"
End If

If DataCombo2.Text <> "" Then
wherestr = " and ID='" & DataCombo2.BoundText & "'" & wherestr
End If

If DataCombo3.Text <> "" Then
wherestr = " and 姓名='" & DataCombo3.BoundText & "'" & wherestr
End If

If DataCombo4.Text <> "" Then
wherestr = " and 工作室='" & DataCombo4.BoundText & "'" & wherestr
End If

strquery = "select * from [Consultant] where1=1 " & wherestr
Adodc1.RecordSource = strquery
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End Sub
...全文
83 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
of123 2012-04-25
  • 打赏
  • 举报
回复
strquery = "select * from [Consultant] where 1=1 " & wherestr

空格

743

社区成员

发帖
与我相关
我的任务
社区描述
VB 版八卦、闲侃,联络感情地盘,禁广告帖、作业帖
社区管理员
  • 非技术类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧