sql:='select * from table1 where mc:=pmc';with adszcyj do 
begin
    Active:=false;
    Parameters.CreateParameter('=pmc',ftstring, pdInput, 16,'') ;
    Parameters.ParamByName('=pmc').Value:='xx';
    CommandText:=sql;
    Active:=true;
end;显示第一行‘mc@P1’附近有语法错误。

解决方案 »

  1.   

    with adszcyj do 
    begin
        Close;
        SQL.Clear;
        SQL.Add('select * from table1 where mc:=pmc');
        Parameters[0].Value:='xx';
        Open;
    end;
      

  2.   

    to hnhb(不死鸟) :
    您的代码是对TADOQuery的吧。我用的是TADODataSet
      

  3.   

    别用参数 直接
    sql:='select * from table1 where mc ='+#39+'xx'+#39
      

  4.   

    應該是這樣吧﹐不過我沒試
    sql:='select * from table1 where mc=:pmc';with adszcyj do 
    begin
        Active:=false;
        CommandText:=sql;
      //  Parameters.CreateParameter('pmc',ftstring, pdInput, 16,'') ;
        Parameters.ParamByName('pmc').Value:='xx';
        
        Active:=true;
    end;
      

  5.   

    sql:='select * from table1 where mc:=pmc';
    改为sql:='select * from table1 where mc=:pmc';