Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

17.05 Create Dataset Manually with the IDE

Creating a DataSet Manually with the IDE

The last method of building a dataset assumed that you have a table that can be dragged and dropped onto the designer. There are times you want to build without an existing data source. This could be a report based on user input or internal calculations. No worries, you can still use the IDE to create a dataset manually.

Just like before, add a DataSet object to your project. Right-click on the menu item Project | Add New Item. The Add New Item dialog box lists Dataset File as an option. Select this option, give it an appropriate filename and click OK.

The designer shows a blank screen. Right-click anywhere on the designer and select Add | New Element. In the first column of the first row type in the table name and press the Tab key twice. In Figure 17-3 I named the table ManualTable.



Figure 17-3. A new DataSet table.

Each field in a table is defined as an XML Element with a field name and data type. On the second row click on the first column and a dropdown list appears. Select the Element item.


Next enter a field name and a data type. In this example I created a field EmployeeId of type int and EmployeeName of type string.


The dataset is complete. After saving the file it can be referenced by a report.

If you make changes to the dataset schema after creating the report, the reports will not recognize these changes. It keeps the schema in its cache and doesn’t refresh. The only way to force it to renew the cache is to completely close the Visual Studio IDE, re-open the project, right-click on the report and select Database | Verify Database.