delphi 数据库查询中的SQL 语句 总是报错from 子语句错误,请大神们看看 哪里有问题?!
procedureTmainfrm.RzBitBtn4Click(Sender:TObject);varcx,cx1,cx2,cx3,cx4:string;begincx...
procedure Tmainfrm.RzBitBtn4Click(Sender: TObject);
var
cx,cx1,cx2,cx3,cx4:string;
begin
cx1:='1=1';
cx2:='1=1';
cx3:='1=1';
cx4:='1=1';
if xmcheckbox.Checked then cx1:='engineer_name like ''%'+xmedit.text+'%'+'''';
if rccheckbox.Checked then cx2:='engineer_come between #'+datetostr(datetimepicker1.Date)+'# and #'+datetostr(datetimepicker2.Date)+'#';
if qycheckbox.Checked then cx3:='engineer_area like '''+'%'+qyedit.text+'%'+'''';
if fzrcheckbox.Checked then cx4:='engineer_leader like '''+'%'+fzredit.Text+'%'+'''';
cx:= 'select * from tb_engineer where'+cx1+'and'+cx2+'and'+cx3+'and'+cx4;
engineerquery.Close;
engineerquery.SQL.Clear;
engineerquery.SQL.Add(cx);
engineerquery.Open;
end; 展开
var
cx,cx1,cx2,cx3,cx4:string;
begin
cx1:='1=1';
cx2:='1=1';
cx3:='1=1';
cx4:='1=1';
if xmcheckbox.Checked then cx1:='engineer_name like ''%'+xmedit.text+'%'+'''';
if rccheckbox.Checked then cx2:='engineer_come between #'+datetostr(datetimepicker1.Date)+'# and #'+datetostr(datetimepicker2.Date)+'#';
if qycheckbox.Checked then cx3:='engineer_area like '''+'%'+qyedit.text+'%'+'''';
if fzrcheckbox.Checked then cx4:='engineer_leader like '''+'%'+fzredit.Text+'%'+'''';
cx:= 'select * from tb_engineer where'+cx1+'and'+cx2+'and'+cx3+'and'+cx4;
engineerquery.Close;
engineerquery.SQL.Clear;
engineerquery.SQL.Add(cx);
engineerquery.Open;
end; 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询