ComponentOne Reports for WinForms Designer Edition: ComponentOne Reports for WinForms > Working with C1Report > Creating, Loading, and Rendering the Report > Loading Report Data > Loading Data from a Database

Loading Data from a Database

The simplest option for loading the report data is to set the C1Report control's DataSource properties: ConnectionString and RecordSource. If these properties are set, C1Report uses them to load the data from the database automatically and no additional work is needed.

To select a data source for a new report:

1.   In the C1ReportDesigner application, select the Add New Report button:

 

 

 

The C1Report Wizard appears and walks you through the steps of creating a new report from start to finish.

2.   In the first step of the wizard you must select a data source. Click the Build connection string button . The Data Link Properties dialog box appears.

3.   You must first select a data provider. Select the Provider tab and select a data provider from the list. For this example, select Microsoft Jet 4.0 OLE DB Provider.

 

4.   Click the Next button or select the Connection tab. Now you must choose a data source.

5.   To select a database, click the ellipsis button. The Select Access Database dialog box appears. For this example, select the Nwind.mdb located in the ComponentOne Samples\Common directory in the Documents or My Documents folder. Note that this directory reflects the default installation path and its path may be different if you made changes to the installation path.

6.   Click Open. Test the connection, if you choose, and click OK.

7.   Click OK to close the Select Access Database dialog box.

8.   Once you have selected your data source, you can select a table, view, or stored procedure to provide the actual data. You can specify the RecordSource string in two ways:

      Click the Table option and select a table from the list.

      Click the SQL option and type (or paste) an SQL statement into the editor.

For example:

select * from products inner join categories on categories.categoryid = products.categoryid

9.   Click Next. The wizard will walk you through the remaining steps.

For more details on the C1Report Wizard, see Creating a Basic Report Definition.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.