在delphi中下面第6行中a,b 为变量,这样写有没有错误?with ADOQuery1 do
           begin
            close;
            sql.Clear;   
            sql.Add('Select sth,stnr,xxa,xxb,xxc,xxd,sjbh from dxxz ');   
            sql.Add(' where sjbh like a+b+'%');
            sql.Add(' order by sth');
            open;
            end;

解决方案 »

  1.   

    sql.Add(' where sjbh like "'+a+b+'"%');
      

  2.   

    sql.Add(' where sjbh like '+a+b+'%');
      

  3.   

    sql.Add(' where sjbh like "'a+b+'"%');
      

  4.   

    Oracle Database:
    sql.Add(' where sjbh like '''a+b+'%''');Sql Server:
    sql.Add(' where sjbh like "'a+b+'%"');
      

  5.   

    第6句好有问题。      因为a+b+c+%是一个被查询的值你的格式有问题。      如果上面写的有问题      请查询SQL语法从书。