In D7 + ACCESS + fastreport 3.15, the following proxies are used.
1. Store fastreport in the Data preview:
Insert the following generation sequence in The onclick event of "insert" by values in the window:
(Insert_rep: tadoquery. Set SQL statement: Select * From reportdata.
Note: reportdata is the table for storing data records, including the field ID and report ))
Procedure tform1.button4click (Sender: tobject );
VaR
Template: tstream;
Begin
Template: = tmemorystream. Create;
Template. Position: = 0;
Frxreport1.savetostream (Template );
Insert_rep.insert;
Try
Insert_rep.active: = true;
Insert_rep.edit;
Insert_rep.disablecontrols;
Insert_rep.fieldbyname ('rptname'). asstring: = extractfilename (opendialog1.filename); // specify the table name as the index for reading table data
(Insert_rep.fieldbyname ('rptdata') as tblobfield). loadfromstream (Template );
Insert_rep.fieldbyname ('uptime'). asdatetime: = now;
Insert_rep.append;
Showmessage ('insert OK! ');
Finally
Insert_rep.enablecontrols;
Template. Free;
End;
End;
2. Extract the orders table from the data centers:
In The onclick event of the button, add the following Token Generation:
(Qr_report: adoquery)
Procedure tform1.button4click (Sender: tobject );
VaR
Template: tstream;
Begin
Try
G_filename: =...; // Partition Table Name
Qr_report.close;
Qr_report. SQL .clear;
Qr_report. SQL .add ('select * From reportdata where id =: id ');
Qr_report.parameters.parambyname ('id'). Value: = g_filename;
Qr_report.open;
Try
Template: = qr_report.createblobstream (qr_report.fieldbyname ('report'), bmread );
Template. Position: = 0;
Frxreport1.loadfromstream (Template );
Finally
Template. Free;
End;
End;
End;
3. Modify the tables Table and add data to the tables Table.
Add the following generation to the onsavereport event of the frxdesigner1 control:
(After the design table is created, click the "save" icon in the "single-dataset" table to issue the event)
Function tform1.frxdesigner1savereport (Report: tfrxreport;
Saveas: Boolean): Boolean;
VaR template: tstream;
Begin
Template: = tmemorystream. Create;
Template. Position: = 0;
Frxreport1.savetostream (Template );
Qr_report.edit;
Try
Qr_report.disablecontrols;
(Qr_report.fieldbyname ('report') as tblobfield). loadfromstream (Template );
Qr_report.post;
Finally
Qr_report.enablecontrols;
Template. Free;
End;
End;