1 referencing DLLs first in a program
Display Code Printing
Using Fastreport;
Using FASTREPORT.EXPORT.PDF;
Using Fastreport.data;
Using Fastreport.format;
2 dynamic data through the SQL State DataSet, such as:
Display Code Printing
DataSet idataset = db. Executesqlgetdataset (SQL, "Frform");
DataSet fdataset = db. Executesqlgetdataset (SQL, "Fritem");
3 Loading template Bonding data
Display Code Printing
The new ();
Cox. Load ("Report\test.frx"); Here is the registration data for the report the second parameter represents the alias of this data in the report, which is the [frform] in the template. CName] Frform corresponding name
Cox. Registerdata (Idataset.tables[0], "frform");
Cox. Registerdata (Fdataset.tables[0], "Fritem"); Find DataBind data must register data before it can be set
Databand data = the. Findobject ("Data1") as Databand;
Data. DataSource = the. Getdatasource ("Frform"); If you have a subreport, you should also state the stator report
Databand Datasubreport = the. Findobject ("Data2") as Databand;
Datasubreport. DataSource = the. Getdatasource ("Fritem");
Cox. Prepare ();
Export PDF
Pdfexport export = new Pdfexport ();
Cox. Export (export, "pdf\" +datetime.now.tostring ("YYYYMMDDHHMMSS") + ". PDF");
Display
Cox. Show ();
Releasing resources
Cox. Dispose ();