Quantcast
Viewing all articles
Browse latest Browse all 17

Crystal Report Hosting :: How to Generate a Crystal Reports Report Without a Database

For generating a Crystal Reports without database , here we are using a Strongly Typed Dataset and a Data Table.

Using the code

Create the Project:

  1. File -> New -> New project

Create a New Crystal Reports Visual Basic Windows Application.

Create the DataSet schema:

  1. Right click the Crystal Reports project -> Add -> New Folder

Name it DataSets:

  1. Right click the DataSets folder -> Add -> New Item

Create a new CRDataSet DataSet:

  1. Right click the CRDataSet Designer Page -> Add -> New Element

Name it MainTable:

  1. Add new Field1, Field2, Field3 rows.
  2. Repeat steps 3 and 4, add a new DetailTable element.

You will have the following DataSet tables schema:

Image may be NSFW.
Clik here to view.

Create the Crystal Reports report:

  1. Right click the Crystal Reports project -> Add -> New Folder

Name it Reports:

  1. Right click the Reports folder -> Add -> New Item

Open a new MainReport Crystal Reports report:

  1. Click the Register Later button to close the annoying register window, if it appears.
  2. Select Subreport and click OK. In the Contain Subeport Expert window Data tab, expand Project Data -> ADO.NET DataSet -> CrystalReport.CRDataSet.
  3. Select MainTable. Click the Insert Table button.
  4. Click Next.
  5. Click the Add All button. Click Next. Click Next. Click Next.
  6. Next to the Create a Subreport choice of the Subreport window tab, type DetailReport in the Report Nameedit box.
  7. Click the Report Expert button. Insert DetailTable. Click Next to open the Subreport Generator.
  8. Add All fields. Click Next. Click Next. Click Next. Click Next.
  9. Type “No DB Subreport Crystal Report Sample” as the Subreport Title.
  10. Click Finish.

Click Next. Type “No DB Crystal Report Sample.” as the Main Report title. Click Finish.

Image may be NSFW.
Clik here to view.

Add the a CrystalReportViewer1 to the form:

  1. Open the Form1 form. Click View -> Toolbox in the menu.
  2. Drag (from the bottom of the Windows Forms tab in the Toolbox) a CrystalReportViewer into the form.
  3. Right click the CrystalReportViewer1 CrystalReportViewer in the form -> Properties.
  4. Set the Dock property to Fill.

Add the code to fill and show the Crystal Reports report:

Right click the Form -> View Code. Add the following Form1_Activated method:

Image may be NSFW.
Clik here to view.

Add the following FillDataSet method:

Image may be NSFW.
Clik here to view.

Build and run the application.


Viewing all articles
Browse latest Browse all 17

Trending Articles