Let's look at the design of a simple report using data access components at runtime. It will use the Demo.mdb database that comes with FastReport as the data source - {FR}\Demos\Main\demo.mdb.
Create a new Delphi project and add one each of “TfrxReport”, “TfrxDesigner”, “TfrxDialogControls”, “TfrxADOComponents”, "TADOConnection" and "TButton” components to the form.
Setup the database connection by double-clicking on the “TADOConnection”, and choosing "Build connection string", the provider ("Microsoft Jet 4.0 OLE DB Provider") and the database ({FR}\Demos\Main\demo.mdb). Close the connection dialogue with OK and set the component properties here:
ADOConnection1:
LoginPrompt = False
frxADOComponents1:
DefaultDatabase = ADOConnection1
Define the following handler for the “Design” button:
procedure TForm1.Button1Click(Sender: TObject);
begin
frxReport1.DesignReport;
end;
After that, compile and run the project. This is all you need to do to create an end-user runtime reports designer.
When the “Design” button is clicked the FR report designer opens, containing a blank report. Let's look at the design of a simple report in this environment.
|