Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

17.14 Binding to the Schema File

Build the Report Using the Dataset Schema File

For a report to use a dataset as its data source, it needs to know how the data is structured. It uses the schema file to determine the structure.The previous section showed three different ways to create the dataset schema file. The way that you created the dataset determines how it links to the report.

If you used the IDE to create a dataset, open the Database Expert, and expand the category Project Data > ADO.NET Datasets. This lists all the datasets in the project. Expand the dataset you created to see the list of tables within it. Add the appropriate tables to the Selected Tables window on the right. Go to the Links tab to establish relationships between the tables.

If you created a dataset file manually, open the Database Expert and click on the category called Create New Connection. Under it you will see the ADO.NET node. Expand this node to select Make New Connection and the dialog box in Figure 17-5 will open.





Figure 17-5. The ADO.NET (XML) dialog box.

This dialog box lets you browse the schema files on your computer. You can select a dataset that was created with the IDE or one created using the WriteXmlSchema() method. After entering the file path for the schema, enter a class name (you can enter anything here and it doesn’t matter).

Click the Finish button and design the report as normal. When finished with the report layout, go to the next steps to populate the dataset.

Once the report is bound to a dataset file, the file is no longer used by the report. The schema information is saved within the report file. You can delete the dataset file after binding it and it will have no effect.