Create a Crystal Reports Template with an ADO.NET (XML) Connection to an XML Schema
Note: This activity describes using Visual Studio 2005 with the Crystal Reports application. Activity steps may vary with later versions of these applications. This activity does not explain the installation, configuration or in-depth information for Microsoft Visual Studio, Crystal Reports or Microsoft SQL Server. See your network administrator for installation and configuration information.
Create a Windows Application project
- Either double-click the Microsoft Visual Studio icon on the desktop, or select Start » All Programs » Microsoft Visual Studio 2005 » Microsoft Visual Studio 2005.
The Visual Studio .NET 2005 application opens.
- In Microsoft Visual Studio, select File » New » Project from the main menu.
A new Windows Application project opens.
- Select the Visual C# » Window project type from the project types list.
- Select Windows Application from the templates list.
- Enter the Name.
- Enter the Location.
- Check Create directory for solution.
- Click OK.
The Windows Application form opens.
Create the XML Schema
- Right-click the Windows Application Project and select Add » New Item » XML Schema from the menu.
- Click Add.
This step opens a design page to design the dataset.
- Right-click the design page and add the fields required for the report.
- Click Save.
Create the Crystal Reports Template File
- Right click the Windows Application Project and select Add » New Item » Crystal Report from the menu.
- Click Add.
This step creates a Crystal Reports project and opens the Visual Studio 2005 Form Design Screen, displaying the Crystal Reports Gallery form.
- Select As a Blank Report from the Crystal Reports Gallery form.
- Click OK.
This step creates and opens a blank report template, and either opens the blank Crystal Reports template or opens the Data Expert form.
- If the Data Expert form is not opened, right-click Database Fields in the Fields Explorer field group and select Database Expert from the menu.
- Expand the Create New Connection node.
- Expand the ADO.NET(XML) node.
The ADO.NET (XML) form opens.
- Double-click Make New Connection.
- Click the ellipsis (...) next to the File Path.
- Locate and select the XSD file created in the previous steps.
- Click Open.
- Click Finish.
This step closes the ADO.NET form and returns control to the Database Export form. A new XSDSchema connection with the same name as the .XSD file displays.
- Locate and select the XML schema from the Available Data Sources.
- Click > to move it to the Selected Tables group.
- Repeat adding XML schemas as required for the report.
- Click OK.
When more than one dataset is added to the report template, the Links tab displays.
- Select the Links tab.
- Expand the form if all datasets are not visible, and ensure that no datasets are hiding behind other datasets.
- Enter the links to relate the datasets to each other.
- Click Auto-Arrange to rearrange the datasets and links in a logical order.
- Click OK.
This closes the Database Expert form and returns control to the Report Template form.
- Expand the Database Fields node in the Field Explorer field group.
- Build the report by dragging fields onto the Report Template form.
- Click Save.
Note: Save the report template to the Report Template folder, ensuring that the name is unique.
- Exit the Crystal Reports application.
- If using the Microsoft Visual Studio application, exit it.