Crystal Reports from XML File
In this section, we will explore the process of creating Crystal Reports using an XML file instead of a traditional database as the data source. The methodology for creating Crystal Reports from an XML file is quite similar to that of creating reports from a database. The key distinction lies in selecting the data source as your XML file.
To begin, we will create an XML file named "Product," which mirrors the structure of the Product table found in the sample Database Structure. This XML file will serve as the data source for our Crystal Reports.
Before proceeding with this section, it is assumed that you have a basic understanding of Crystal Reports creation. However, if you are new to Crystal Reports or require a refresher, I recommend referring to the step by step Crystal Report tutorial provided earlier in the tutorials. This tutorial offers a comprehensive guide on creating Crystal Reports, ensuring you have the necessary knowledge to proceed with this section.
The key change in this section lies in the selection of data for your Crystal Report. Instead of choosing a traditional database as the data source, you will opt for a different approach. When selecting the data for your Crystal Report, you will navigate to the "Create New Connection" option and choose "Database Files." From there, you will select the XML file you wish to use for generating the Crystal Reports, specifically the "Product.xml" file in this case.
Select all the fields from Product and click finish button
Now the designer part is over . Next step is to select the default form(Form1.vb) and add a Button and Crystal Reports Viewer to the Form.
Put the following vb.net source code in your form and run the program .Full Source VB.NET
cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt")
The Crystal Report is in your project location, there you can see CrystalReport1.rpt . So give the full path name of report here.