Store fastreport in the data warehouse, export and update

Source: Internet
Author: User

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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.