Loading Data from a Database
In This Topic
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:
- In the C1ReportDesigner application, select the New Report button:
The C1Report Wizard appears and walks you through the steps of creating a new report from start to finish.
- In the first step of the wizard you must select a data source. Click the ellipses button of Connection string tab. The Data Link Properties dialog box appears.
- 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.
- Click the Next button or select the Connection tab. Now you must choose a data source.
- To select a database, click the ellipsis button. The Select Access Database dialog box appears. For this example, select the C1NWind.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.
- Click Open. Test the connection, if you choose, and click OK.
- 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
- Click Next. The wizard will walk you through the remaining steps.
For more details on the C1Report Wizard, see Step 1 of 4: Creating a Report Definition.