procedure Tinfocxform.cxbutClick(Sender: TObject);
var
  strSql :string;
begin
  datamodule1.kccx.Active:=false;
  strSql:='select * from yjsj where no=:jsjno';
  datamodule1.kccx.SQL.Clear;
  datamodule1.kccx.SQL.Add(strsql);
  datamodule1.kccx.Parambyname('jsjno').AsString:=trim(xlhedit.Text);
  datamodule1.kccx.Active :=true;
end;
没有错误提示,但是得不到预期的结果(满足WHERE条件的结果),查询时一条记录也不显示

解决方案 »

  1.   

    1、将SQL在查询分析器中执行看是否有结果集
    2、这样试试!
      datamodule1.kccx.Close;
      strSql:='select * from yjsj where no=:jsjno';
      datamodule1.kccx.SQL.Clear;
      datamodule1.kccx.SQL.Add(strsql);
      datamodule1.kccx.Parambyname('jsjno').AsString:=trim(xlhedit.Text);
      datamodule1.kccxOpenb
      

  2.   

    'select * from yjsj where no='+'''jsjno'''
      

  3.   

    procedure Tinfocxform.cxbutClick(Sender: TObject);
    var
      strSql :string;
    begin
      datamodule1.kccx.Active:=false;
      strSql:='select * from yjsj where no= '''+trim(xlhedit.Text)+'''';
      datamodule1.kccx.SQL.Clear;
      datamodule1.kccx.SQL.Add(strsql);
      datamodule1.kccx.Active :=true;
    end;ORprocedure Tinfocxform.cxbutClick(Sender: TObject);
    var
      strSql :string;
    begin
      datamodule1.kccx.Active:=false;
      strSql:='select * from yjsj where no=:jsjno';
      datamodule1.kccx.SQL.Clear;
      datamodule1.kccx.SQL.Add(strsql);
      datamodule1.kccx.Parambyname('jsjno').AsString:=''''+trim(xlhedit.Text)+'''';
      datamodule1.kccx.Active :=true;
    end;