代码如下,老提示 ... Parameter 'wdbh' not find ...,表里实际是有的,查询出来有一条记录也显示在DBGrid表里出错在哪????   with f_tjhz do
      begin
        sqaddr_sql.close();
        sqaddr_sql.SQL.Clear;
        sqaddr_sql.SQL.Add('select * from oper where jb=:jb and bh=:bh');
        sqaddr_sql.Parameters.ParamByName('jb').value:=JB_user;//JB_user已经定义的全局变量
        sqaddr_sql.Parameters.ParamByName('bh').value:=BH_user;//BH_user已经定义的全局变量
        sqaddr_sql.Active:=true;
        sqaddr_sql.open;
        f_tjhz.Edit1.Text:=trim(Parameters.ParamByName('wdbh').value);------->字段wdbh实际存在
      end;

解决方案 »

  1.   

     你没有定义 wdbh 这个参数f_tjhz.Edit1.Text:=trim(sqaddr_sql.fieldbyname('wdbh').asstring); 
      

  2.   

      with f_tjhz.sqaddr_sql do 
          begin 
            close(); 
            SQL.Clear; 
            SQL.Add('select * from oper where jb=:jb and bh=:bh'); 
            Parameters.ParamByName('jb').value:=JB_user;
             Parameters.ParamByName('bh').value:=BH_user;
            open; 
            Edit1.Text:=trim(fieldbyname('wdbh').asString); 
          end;
      

  3.   

    是fieldbyName 也就是字段名,而不是参数.