ADOQuery3_shouhuo.Close;
  ADOQuery3_shouhuo.SQL.Clear;
  ADOQuery3_shouhuo.SQL.Add('select * from shosetb where s_id='+''''+edit1.Text+'''');
  ADOQuery3_shouhuo.SQL.Add(' and size='+''''+ComboBox3.Text+'''');
  ADOQuery3_shouhuo.Open;上面代码实现功能:
在edit1.Text,ComboBox3.Text中输入内容,查询同时满足条件的纪录,但上述代码编译出错,请指教,谢谢!错误提示信息:“未指定的错误”

解决方案 »

  1.   

    s_id,size是整形吧,不用加引号ADOQuery3_shouhuo.Close;
      ADOQuery3_shouhuo.SQL.Clear;
      ADOQuery3_shouhuo.SQL.Add('select * from shosetb where s_id='+edit1.Text);
      ADOQuery3_shouhuo.SQL.Add(' and size='+ComboBox3.Text);
      ADOQuery3_shouhuo.Open;
      

  2.   

    你的size字段是不是字符型數據?如果不是(如是數值型)就會出錯。
      

  3.   

    1楼的方法还是编译后出错size字段是文本型的。快疯啦,还是没有改过啦!
      

  4.   

    这样写看看
    ADOQuery3_shouhuo.SQL.Add('select * from shosetb where s_id='''+edit1.Text+''' ');
    ADOQuery3_shouhuo.SQL.Add(' and size='''+ComboBox3.Text+'''');
      

  5.   

    ADOQuery3_shouhuo.Close;
    ADOQuery3_shouhuo.SQL.Clear;
    ADOQuery3_shouhuo.SQL.Add(' select * from shosetb where s_id='''+ trim(edit1.Text)+''' ');
    ADOQuery3_shouhuo.SQL.Add(' and size='''+ trim(ComboBox3.Text)+''' ');
    ADOQuery3_shouhuo.open;
      

  6.   

    直接将SQL语句写在txt文本中,然后从中加载,
    如:
    SQLtxt=Update DemoTable Set UserName='%S' Where id=%S然后再程序中加载的时候:
    用Format格式化即可。这样就不会出错的,
      

  7.   

    同意楼上:)
    const sql:string  = 'Update DemoTable Set UserName=%s Where id=%S';
    begin
      qry1.close;
      qry1.sql.text:= format(sql,[quotedStr(str1),quotedStr(str2)]);
      qry1.execute;
    end;
      

  8.   

    size 应该是sql的关键字吧,改成[size]试试
      

  9.   

    把三个单引号那个换成char(39)