|
Crystal Reports XI Release 2 |
|
Creating a Report that Connects to the DataSet Schema
In the previous steps, you created a method that populates the DataSet schema with data from the database. In this section, you create a Crystal report that bases its data connectivity on the CustomerDataSetSchema schema.
To create a Crystal report that connects to the CustomerDataSetSchema schema
- In Solution Explorer, right-click the project name that is in bold type, point to Add, and then click Add New Item.
- In the Add New Item dialog box, in the Visual Studio installed templates list, select Crystal Report.
- In the Name field, enter the name "Customer.rpt" and click Add.
Note In Visual Studio .NET 2002 or 2003, the button is named Open.
- If you have not registered before, you are asked to register. To learn how to register, see Crystal Reports Registration and Keycode.
- In the Create New Crystal Report Document panel of the Crystal Reports Gallery dialog box, select Using a Report Wizard.
- In the Choose an Expert panel, select Standard, and then click OK.
- In the Available Data Sources panel of the Standard Report Creation Wizard window, expand the Project Data folder.
- Expand the ADO.NET DataSets node.
- This step has two options: one for use with the strongly-typed DataSet class (that is available with Visual Studio .NET 2002 or 2003 projects and with Visual Studio 2005 Windows projects.) and one for use with the generic DataSet class (that is available with Visual Studio 2005 Web Sites).
- For projects that use the strongly-typed DataSet class, expand the CustomerDataSetSchema node. Expand the Tables node if there is one.
- For projects that use the generic DataSet class in Visual Studio 2005 Web Sites, expand the DataSetConfiguration node.
In the ADO.NET (XML) dialog box, select Use DataSet from Class. In the DataSet Names dialog box, select the CustomerDataSet property, and then click Finish.
- Select the Customer table node.
- Double-click the Customer table to move the table into the Selected Tables panel, and then click Next.
- Expand the Customer table, then CTRL-click Customer Name, Contact Title, Address1, Customer Las Name and City.
- Click the > symbol to move these fields into the Fields to Display panel, then click the Next button.
- In the Available Fields panel, under Report Fields, select Customer.City, click the > symbol to move the field into the Group By panel, and then click the Finish button.
The Customer report is created, with data connectivity to the CustomerDataSetSchema (or, in a Visual Studio 2005 Web Site, to the CustomerDataSet property of the DataSetConfiguration class.)
Continue to Binding the Report and Setting the DataSource to the Populated DataSet.
See Also
Tutorial: Connecting to ADO.NET DataSets | Tutorials and Sample Code | Tutorials' Sample Code Directory