Configuring the Report for the CrystalReportSource Control
In this section, you use the Report Wizard to configure the report and add it to the CrystalReportSource control. You create a database connection, set up the fields for the report, and then add the report to the control. Once you are finished, you test your reduced-code Web Site.
To configure the report for the CrystalReportSource control
If the Registration Wizard dialog box appears, you need to register your copy of Crystal Reports. You have two choices:
- Click Next to register now.
- Click Register Later to register later.
After registering or choosing to register later, proceed to the next step.
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, do the following:
1. Expand the Create New Connection folder.
2. Expand the ODBC (RDO) folder.
In the ODBC (RDO) window, select the correct ODBC DSN entry for your version of Crystal Reports, as explained in ODBC DSN Entry for Xtreme Sample Database, and then click Finish.
Expand the Tables node and select the Customer table.
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, Contact Last Name and City.
Click the > symbol to move these fields into the Fields to Display panel, and then click Next.
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 Finish.
The XtremeCustomers report is created and loaded into the main window of Visual Studio.
At the bottom of the window, click Main Report Preview.
Note
The Preview button is available for the first time in the embedded Crystal Reports Designer that ships with Crystal Reports for Visual Studio 2005.
The report is displayed in preview mode and shows data from the Xtreme database.
At the bottom of the window, click Main Report to exit preview mode.
Open the Web Form.
From the View menu, click Designer.
The report is displayed in Design Time Preview mode, which shows the graphic layout for the report on the Web Form.
- From the File menu, click Save All.
To test the reduced-code Web Site
Your report is created and designated as the report for the CrystalReportSource control. You are now ready to build and run your project.
- From the Build menu, select Build Solution.
- If you have any build errors, go ahead and fix them now.
- From the Debug menu, click Start.
- The XtremeCustomers report is displayed in the Web browser.
- Return to Visual Studio and click Stop to exit from debug mode.