VB数据库SQL语句查询

2025-05-15 03:53:53
推荐回答(4个)
回答1:

唉 你在"and"的前面 多加一个空格吧

回答2:

sql语句看起来没错,Combo1.Text 取出来的值是你选中的项的值吗?

回答3:

Adodc1.RecordSource ="select * from 订餐管理 where 年='" + Combo1.Text + "' and 月='" + Combo2.Text + "' and 日='" + Combo3.Text + "'

注意空格!

回答4:

Adodc1.RecordSource = "select * from 订餐管理 where 年='" + Combo1.Text.tostring()+ "' and 月='" + Combo2.Text.tostring() + "' and 日='" + Combo3.Text.tostring() + "'"
两个问题,
1、控件用Text.tostring()取字符串,比较规范。
2、你and命令少了空格。