程序想实现向adoQuery中传递sql参数,然后把查询结果以RAVE表示,
代码如下,但报表是空的, 不知道什么地方有问题。
var
  trdv: TRaveDataView;
  sqlstr:string;
begin
  ....
  adoquery1.SQL.add(sqlstr);
  adoquery1.ExecSQL;
  if not adoquery1.Active then
    adoquery1.Active:=true;
  trdv := RvProject1.ProjMan.NewDataObject(TRaveDataView) as TRaveDataView;
  trdv.ConnectionName := 'RvDataSetConnection1';
  CreateFields(trdv,nil,nil,true);
  rvproject1.Execute;end;

解决方案 »

  1.   

    var
      trdv: TRaveDataView;
      sqlstr:string;
    begin
      ....
      adoquery1.sql.clear;////////////here
      adoquery1.SQL.add(sqlstr);
      adoquery1.open;/////////////here
      if not adoquery1.Active then
        adoquery1.Active:=true;
      trdv := RvProject1.ProjMan.NewDataObject(TRaveDataView) as TRaveDataView;
      trdv.ConnectionName := 'RvDataSetConnection1';
      CreateFields(trdv,nil,nil,true);
      rvproject1.Execute;end;