在程序中创建FASTREPORT报表,显示“符号没有定义”,请问如何解决,我把源码贴出来,大家帮我看看 ( 积分: 100 )

  • 主题发起人 主题发起人 citybug_ch
  • 开始时间 开始时间
C

citybug_ch

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, FR_DSet, FR_DBSet, FR_Class, DB, ADODB, StdCtrls, FR_Rich, FR_View;

type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
ADOConnection1: TADOConnection;
Memo2: TMemo;
Memo3: TMemo;
frReport1: TfrReport;
frDB1: TfrDBDataSet;
BaseQuery: TADOQuery;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
strsql: string;
ADOQuery: TADOQuery;
i: integer;
fr: TFrReport;
frDB1,frDB2,frDB3:TFrDBDataSet;
BaseQuery,PassedQuery,UnPassQuery: TADOQuery;
frRichObject1:TfrRichObject;
begin
Fr:=TFrReport.Create(self);
Fr.PreviewButtons:=[pbPrint, pbExit];
frRichObject1:=TfrRichObject.Create(nil);
FrDB1:=TFrDBDataSet.Create(nil);
FrDB2:=TFrDBDataSet.Create(nil);
FrDB3:=TFrDBDataSet.Create(nil);
BaseQuery:=TADOQuery.Create(nil);
BaseQuery.Connection :=ADOConnection1;
PassedQuery:=TADOQuery.Create(nil);
PassedQuery.Connection :=ADOConnection1;
UnPassQuery:=TADOQuery.Create(nil);
UnPassQuery.Connection :=ADOConnection1;
frDB1.DataSet :=BaseQuery;
frDB2.DataSet :=PassedQuery;
frDB3.DataSet :=UnPassQuery;
fr.Dataset :=frDB1;
ADOQuery:=TADOQuery.Create(nil);
strsql:='select sqlstr from reportsql where ReportID=''0000000015''';
ADOQuery.Connection :=self.ADOConnection1 ;
ADOQuery.SQL.Text :=strsql;
ADOQuery.open ;
for i:=0 to ADOQuery.RecordCount -1 do
begin
case i of
0:
begin
BaseQuery.SQL.Text :=ADOQuery.fieldByName('sqlstr').AsString + '''' + '0000000046' + '''';
BaseQuery.Open ;
memo1.Text :=BaseQuery.SQL.Text;
end;
1:
begin
PassedQuery.SQL.Text :=ADOQuery.fieldByName('sqlstr').AsString + '''' + '0000000046' + '''';
PassedQuery.Open ;
memo2.Text :=PassedQuery.SQL.Text;
end;
2:
begin
UnPassQuery.SQL.Text :=ADOQuery.fieldByName('sqlstr').AsString + '''' + '0000000046' + '''';
UnPassQuery.Open ;
memo3.Text :=UnPassQuery.SQL.Text;
end;
end;
ADOQuery.Next ;
if ADOQuery.eof then break;
end;

fr.LoadFromFile('BespokeNotice.frf');
fr.PrepareReport ;
fr.ShowReport ;
fr.Free ;
end;

end.
 
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, FR_DSet, FR_DBSet, FR_Class, DB, ADODB, StdCtrls, FR_Rich, FR_View;

type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
ADOConnection1: TADOConnection;
Memo2: TMemo;
Memo3: TMemo;
frReport1: TfrReport;
frDB1: TfrDBDataSet;
BaseQuery: TADOQuery;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
strsql: string;
ADOQuery: TADOQuery;
i: integer;
fr: TFrReport;
frDB1,frDB2,frDB3:TFrDBDataSet;
BaseQuery,PassedQuery,UnPassQuery: TADOQuery;
frRichObject1:TfrRichObject;
begin
Fr:=TFrReport.Create(self);
Fr.PreviewButtons:=[pbPrint, pbExit];
frRichObject1:=TfrRichObject.Create(nil);
FrDB1:=TFrDBDataSet.Create(nil);
FrDB2:=TFrDBDataSet.Create(nil);
FrDB3:=TFrDBDataSet.Create(nil);
BaseQuery:=TADOQuery.Create(nil);
BaseQuery.Connection :=ADOConnection1;
PassedQuery:=TADOQuery.Create(nil);
PassedQuery.Connection :=ADOConnection1;
UnPassQuery:=TADOQuery.Create(nil);
UnPassQuery.Connection :=ADOConnection1;
frDB1.DataSet :=BaseQuery;
frDB2.DataSet :=PassedQuery;
frDB3.DataSet :=UnPassQuery;
fr.Dataset :=frDB1;
ADOQuery:=TADOQuery.Create(nil);
strsql:='select sqlstr from reportsql where ReportID=''0000000015''';
ADOQuery.Connection :=self.ADOConnection1 ;
ADOQuery.SQL.Text :=strsql;
ADOQuery.open ;
for i:=0 to ADOQuery.RecordCount -1 do
begin
case i of
0:
begin
BaseQuery.SQL.Text :=ADOQuery.fieldByName('sqlstr').AsString + '''' + '0000000046' + '''';
BaseQuery.Open ;
memo1.Text :=BaseQuery.SQL.Text;
end;
1:
begin
PassedQuery.SQL.Text :=ADOQuery.fieldByName('sqlstr').AsString + '''' + '0000000046' + '''';
PassedQuery.Open ;
memo2.Text :=PassedQuery.SQL.Text;
end;
2:
begin
UnPassQuery.SQL.Text :=ADOQuery.fieldByName('sqlstr').AsString + '''' + '0000000046' + '''';
UnPassQuery.Open ;
memo3.Text :=UnPassQuery.SQL.Text;
end;
end;
ADOQuery.Next ;
if ADOQuery.eof then break;
end;

fr.LoadFromFile('BespokeNotice.frf');
fr.PrepareReport ;
fr.ShowReport ;
fr.Free ;
end;

end.
 
你的报表里添加了自定义的memo对吗?就是类似[xx]这样的控件,那你的没有给他赋值或者没有关联数据库字段,显示报表的时候就会出错!
 
版主,我可不想就这么把100分给别人了。
问的问题一点都没有帮我解决。
把分还给我![
[:(!]
 
楼猪有rpwt!100分,稀罕那!象你这样的人谁愿意给你回答?
 
看来还要另找办法
 
后退
顶部