我在ADOQuery里面用了这样一条语句:
    with ADOQuery1 do
    begin
       Close;
       SQL.Clear;
       SQL.Add(' select distinct xm from yg where bm=ComboBox1.text');
     Open;
   end;
   提示“参数ADOQuery.text没有默认值”。而改为:
   SQL.Add(' select distinct xm from yg where bm=''ComboBox1.text''');
   却什么结果都没有?
   请教各位高手!

解决方案 »

  1.   

    SQL.Add(' select distinct xm from yg where bm='+QuotedStr(ComboBox1.text));
      

  2.   

    with ADOQuery1 do
        begin
           Close;
           SQL.Clear;
           SQL.Add(' select distinct xm from yg where bm=''' + ComboBox1.text + '''');
         Open;
       end;
      

  3.   

    wl: string;
    begin
      wl := 'select distinct xm from yg where bm=' + '''' + combobox1.text + '''';
      AQ.close;
      AQ.sql.clear;
      AQ.sql.add(wl);
      AQ.open;
    end;//试试看
      

  4.   

    SQL.Add(' select distinct xm from yg where bm=ComboBox1.text');
    => SQL.Add(' select distinct xm from yg where bm='+quotedStr(trim(combobox1.text)));