我开发环境是delphi7+fastreport 3.05。我打算做了一个这样程序,首先把一个数据表中的所有字段名列在一个多选框中,然后用户通过选择多选框的字段名来自动生成一个报表,也就是要制作一个动态报表。下面我程序的代码:
       我在程序窗体内放了一个frxReport1、一个database、一个table、一个按钮。
       procedure TForm1.Button1Click(Sender: TObject);
     var
     v: TfrView;
     b: TfrBandView;
     Page: TfrPage;
     begin
     frReport1.Pages.Clear;
     frReport1.Pages.Add; // create page
     Page := frReport1.Pages[0];
     
     b := TfrBandView(frCreateObject(gtBand, '')); // create MasterData band
     b.SetBounds(0, 20, 0, 20); // position and size in pixels
     b.BandType := btMasterData;
     b.Dataset := 'frDBDataSet1'; // reference to band dataset
     Page.Objects.Add(b);
     
     v := frCreateObject(gtMemo, ''); // create data field
     v.SetBounds(20, 20, 200, 16);
     v.Memo.Add('[Table1."name"]');
     Page.Objects.Add(v);
     
     frReport1.ShowReport;
     
     end;
     
     程序运行后报以下错误:
     [Error] Unit1.pas(32): Undeclared identifier: 'TfrView'
     [Error] Unit1.pas(33): Undeclared identifier: 'TfrBandView'
     [Error] Unit1.pas(34): Undeclared identifier: 'TfrPage'
     [Error] Unit1.pas(36): Undeclared identifier: 'frReport1'
     [Error] Unit1.pas(36): Missing operator or semicolon
     [Error] Unit1.pas(37): Missing operator or semicolon
     [Error] Unit1.pas(38): Missing operator or semicolon
     [Error] Unit1.pas(40): Undeclared identifier: 'frCreateObject'
     [Error] Unit1.pas(40): Undeclared identifier: 'gtBand'
     [Error] Unit1.pas(41): Missing operator or semicolon
     [Error] Unit1.pas(42): Missing operator or semicolon
     [Error] Unit1.pas(42): Undeclared identifier: 'btMasterData'
     [Error] Unit1.pas(43): Missing operator or semicolon
     [Error] Unit1.pas(44): Missing operator or semicolon
     [Error] Unit1.pas(46): Undeclared identifier: 'gtMemo'
     [Error] Unit1.pas(47): Missing operator or semicolon
     [Error] Unit1.pas(48): Missing operator or semicolon
     [Error] Unit1.pas(49): Missing operator or semicolon
     [Error] Unit1.pas(51): Missing operator or semicolon
     [Error] Unit1.pas(59): Undeclared identifier: 'Sender'
     [Error] Unit1.pas(59): Undeclared identifier: 'btReportTitle'
     [Error] Unit1.pas(62): Missing operator or semicolon
     [Error] Unit1.pas(64): Missing operator or semicolon
     [Error] Unit1.pas(66): Missing operator or semicolon
     [Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
     请问这是怎么回事?我是不是还有哪个单元没有引用?请帮帮我,谢谢!

解决方案 »

  1.   

    首先应该unit frreport(详细查阅说明)等一些单元,否则肯定会出错
      

  2.   

    先别做那么复杂,只放上一个FRXREPORT控件试试,如果有问题,就是你没把控件装好
      

  3.   

    to softest(编程浪子):
    我是中放了一个FRXREPORT控件啊,还有就是一个database、一个table、一个Button1就没有其它的了。
    to  cjzy22() :
      我不太理解你说的意思。“unit frreport”,能不能再讲详细点?
      

  4.   

    to  mydelphiworld(太极居士)
           那3.0版怎么用呢?