Below is the tutorial on how to use Crystal Report in Visual Studio 2008. The following sample is based on the Northwind SQL Server database (http://northwinddatabase.codeplex.com).
Before, we start with the report, you have to make sure that the data that need to be extracted are available. In order to do that, you have to create a DataSet.
Go to Data Sources windows, and click Add New Data Source. (Alternatively, within Visual Studio menu, find Data >> Add New Data Source)
The following window will appear:
Choose Database and click Next.
Click New Connection Button and the following windows will appear:
Pick Data source as Microsoft SQL Server Database File (SqlClient) and browse your mdf file (in this case, you need to locate your mdf file within your project i.e. Northwind.mdf). Click OK and then Next.
Click Yes (or No depends on how you would like your project to work with the database) if the above window appear and Next after the following window.
The following window will then appear:
You can either choose the specific tables or you can just tick All like the above image and then press the Finish button. Once done, the selected items will be appear in the Data Sources windows.
Then, within your project, from main menu in Visual Studio select PROJECT >> Add New Item. Add New Item dialogue will appear and select Crystal Reports from the dialogue box.
Next step is to select the appropriate connection to your database. Since the dataset has been created, you need to pick the History >> Select the DataSet that has been created before. (You can also seeing the connection of the Dataset in Current Connection Folder or you can Create New Connection if there is no items available within History folder).
The Crystal Reports is in your project location, there you can see CrystalReport1.rpt
After you run the source code you will get the report like this.
Read more...