请问一下用vb怎么多条件查询access数据库

2025-04-15 02:38:19
推荐回答(3个)
回答1:

wherestr=""
if combo1.text<>"" then
wherestr=" and 教材='"&combo1.text &"'"
end if

if combo2.text<>"" then
wherestr=" and 单元='"&combo2.text &"'"&wherestr
end if

if combo3.text<>"" then
wherestr=" and 课时='"&combo3.text &"'"&wherestr
end if

wherestr=" where 1=1"&wherestr
sql="select from 表"&wherestr

回答2:

select * from 表名 where 教材='"& combo1.text & "' and 单元='"& combo2.text & "' and 课时=" & combo3.text

回答3:

非文本直接就id=2
不然就id='2'