系统之网络神豪:vb查询问题高手来

来源:百度文库 编辑:神马品牌网 时间:2024/05/08 00:02:20
If Text1.Text <> "" And Text2.Text <> "" And Combo1.Text = "" Then
Adodc1.RecordSource = "select * from 维护表 where 楼房编号 = " & Text1.Text & ""
Adodc1.RecordSource = "select * from 维护表 where 寝室号 = " & Text2.Text & ""
Adodc1.Refresh
这段查询代码运行结果为什么显示出来凡是符合第2句查询语句的项都显示出来了.我要的是既符合查询语句1并符合查询语句2的结果(显然结果应该只有1项).请问要做什么修改

If Text1.Text <> "" And Text2.Text <> "" And Combo1.Text = "" Then
Adodc1.RecordSource = "select * from 维护表 where 楼房编号 = " & Text1.Text & " and 寝室号 = " & Text2.Text
Adodc1.Refresh