Crystal Reports Without Database
Usually Crystal Reports we are using to fetch data from database and show it as a report. Here we are going to generate a Crystal Reports without using a datbase . For generating a Crystal Reports without database , here we are using a Strongly Typed Dataset and a Data Table.
The basics of Crystal Reports creation you can find in the previous section of this tutorial , before we start this tutorial you can take a look at the step by step Crystal Report.
Generating a Strongly Typed DataSet
Create a new VB.NET Project and accept the default settings. Create a new Dataset from Project - Add New Item Dialogue Box.
Accept the default name DataSet1.xsd .
Create a data table for DataSet1.xsd .
Select DataSet1.xsd from Solution Explorer and right click . Select datatable from the menu. Then you will get a datatable in the Datast . Right click the datatable and select Add-Column.
Here we are making a two column Crystal Reports , so we need two column in the data table . Add and ID column and Name column in the Data Table.
Now the dataset part is over . Next step is to create a Crystal Reports from this Dataset . Before going to make Crystal Reports design please take a look at step by step Crystal Report for easy creation of Crystal Reports.
Select a new Crystal Reports from Add New Item menu and accept the default settings. The next screen is to select appropriate data source . There you can find the Datatable1 from Project data - ADO.NET Datasets , and select Datatable1 to the right side.
Click Next button and select ID and Name from the datatable1 to right side and click finish.
Now the Crystal Reports designer part is over . Next part is to create data for the Crystal Reports . For that we have to create a Data Table through programmatically and add data to dataset1.
Select the default form (Form1.vb) you created in VB.NET and drag one button and CrystalReportViewer control to your form.
Put the following source code in the button click events