Delphi中如何用日期和其他条件,查询SQL的日期段内数据?
adoquery1.Close;adoquery1.SQL.Clear;adoquery1.SQL.Add('select*fromzyqdwhere职员姓名=:zyxm...
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from zyqd where 职员姓名=:zyxm and 签到日期 between cong and dao');
adoquery1.Parameters.ParamByName('cong').Value:=datetostr(DateTimePicker1.Date);
adoquery1.Parameters.ParamByName('dao').Value:=datetostr(DateTimePicker2.Date);
adoquery1.Parameters.ParamByName('zyxm').Value:=combobox1.Text;
adoquery1.open;
运行时,老是在查询时,弹出('ADOQuuery1:Parmerter 'cong' not found'.)
本人菜鸟,请叫高手能解决下!谢谢!
单独运行
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from zyqd where 签到日期 between cong and dao');
adoquery1.Parameters.ParamByName('cong').Value:=datetostr(DateTimePicker1.Date);
adoquery1.Parameters.ParamByName('dao').Value:=datetostr(DateTimePicker2.Date);
adoquery1.open;
可以查询到相应的信息,但就是加了“职员姓名=:zyxm and ”,就不行了! 展开
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from zyqd where 职员姓名=:zyxm and 签到日期 between cong and dao');
adoquery1.Parameters.ParamByName('cong').Value:=datetostr(DateTimePicker1.Date);
adoquery1.Parameters.ParamByName('dao').Value:=datetostr(DateTimePicker2.Date);
adoquery1.Parameters.ParamByName('zyxm').Value:=combobox1.Text;
adoquery1.open;
运行时,老是在查询时,弹出('ADOQuuery1:Parmerter 'cong' not found'.)
本人菜鸟,请叫高手能解决下!谢谢!
单独运行
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from zyqd where 签到日期 between cong and dao');
adoquery1.Parameters.ParamByName('cong').Value:=datetostr(DateTimePicker1.Date);
adoquery1.Parameters.ParamByName('dao').Value:=datetostr(DateTimePicker2.Date);
adoquery1.open;
可以查询到相应的信息,但就是加了“职员姓名=:zyxm and ”,就不行了! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询