Form1.qry_2.Close;
Form1.qry_2.SQL.Clear;
Form1.qry_2.SQL.Add(' select * from RC1 where 领货日期 between #'+FormatDateTime('yyyy-mm-dd',edt2.date)+'# and #'+FormatDateTime('yyyy-mm-dd',edt3.date)+'#  and 领货人='''+QuotedStr(edt1.text)+'''  and 元器件ID='''+(edt4.text)+'''');       //语法错误操作符丢失
Form1.qry_2.Open;

解决方案 »

  1.   

    引号有错误,估计是重复了,用了QuotedStr就不要在sql中再加引号了
      

  2.   

    Form1.qry_2.Close;
    Form1.qry_2.SQL.Clear;
    Form1.qry_2.SQL.Add(' select * from RC1 where 领货日期 between :d1 and :d2 and 领货人=:per  and and 元器件ID=:id');
    Form1.qry_2.parameters.parambyname('d1').value :=strtodate(FormatDateTime('yyyy-mm-dd',edt2.date));
    Form1.qry_2.parameters.parambyname('d2').value :=strtodate(FormatDateTime('yyyy-mm-dd',edt3.date));
    Form1.qry_2.parameters.parambyname('per').value :=edt1.text;
    Form1.qry_2.parameters.parambyname('id').value :=edt4.text;
    Form1.qry_2.Open;
      

  3.   


    ' select * from RC1 where 领货日期 between #'+FormatDateTime('yyyy-mm-dd',edt2.date)+'# and #'+FormatDateTime('yyyy-mm-dd',edt3.date)+'#  and 领货人='+QuotedStr(edt1.text)+'  and 元器件ID='''+(edt4.text)+'''';
      

  4.   

    已经QuotedStr了,还用'''来转意,多了2个引号
      

  5.   

    Form1.qry_2.Close;
    Form1.qry_2.SQL.Clear;
    Form1.qry_2.SQL.Add(' select * from RC1 where 领货日期 between #'+FormatDateTime('yyyy-mm-dd',edt2.date)+'# and #'+FormatDateTime('yyyy-mm-dd',edt3.date)+'#  and 领货人='+QuotedStr(edt1.text)+'  and 元器件ID='''+(edt4.text)+'''');      //语法错误操作符丢失
    Form1.qry_2.Open;
      

  6.   

    如果edt4.text输入值允许空值,表达式怎么改