crystal report with dataset
TRANSCRIPT
7/27/2019 Crystal Report With Dataset
http://slidepdf.com/reader/full/crystal-report-with-dataset 1/5
7/27/2019 Crystal Report With Dataset
http://slidepdf.com/reader/full/crystal-report-with-dataset 2/5
Adding a report to the project is easy. The challenge is to fill in the empty report layout. Whether
this is your first report or you are a reporting junkie like me; we must deal with the most basic
building blocks of the report writing. That is, the header, the detail, and the footer.
Typically, reports are designed with specific page size and layout in mind. Our report is Letter
size and Portrait layout. You can explore various properties attached to the report layout by right-clicking anywhere on the open designer surface (gray area) and selecting Report and Design
Properties.
It is always advisable to draw a prototype of your report on paper before you start the design
process. As you can see in Figure 1, we have the report name and report date in the header
section. The body section has the employee list information; the footer carries the page numbers.
Header Section
Our header section is consists of five Text Object, two Line Object and one Special Field.
Please drag and drop Text Object and Line Object from Toolbox -> Crystal Reports. You candrag and drop the “Print Date” special field from Field Explorer -> Special Fields -> Print Date.
You’ll also notice that I’ve changed the color and font after placing the report object on the
designer surface. Please make sure your header looks similar to Figure 8.
Figure 8: Report Header and Footer
7/27/2019 Crystal Report With Dataset
http://slidepdf.com/reader/full/crystal-report-with-dataset 3/5
Footer Section
Footer section is simple; just one special field and one LineObject. As you’ve done with the
header section, you can drag and drop a LineObject from Toolbox -> Crystal Reports.
Similarly, you can drag and drop “Page N of M” special field from Field Explorer -> Special
Fields -> Page N of M. Please see Figure 8 and make sure the Footer look similar.
Detail Section
The Details section of the report will have the CD Catalog list details. Now the question is: From
where will we get the data? Well, as you know, at the beginning we added a DataSet to this
project. We will use this DataSet as the source of data for our report.
Adding a DataSet as source of data for a report is easy. You’ll start with Right-Clicking on any
open area on Report Designer -> Database -> Database Expert… As a result of this action, the
Database Expert dialog box will appear. You can click on Project Data and expand the node
ADO.NET DataSet. Please select the dtCDCatalog DataTable from our DataSet and click on
“>” button to move it to selected tables section on right-hand side (Please see Figure 9).
Figure 9: Adding DataSet as report data source
7/27/2019 Crystal Report With Dataset
http://slidepdf.com/reader/full/crystal-report-with-dataset 4/5
Once the report source is specified, all we have to do is drag and drop the fields from DataTable
inside Detail section on report designer surface. You can drag and drop all the fields fromDataTable starting with “Title” from Field Explorer inside the details section.
As you drag and drop the fields inside the detail section, you’ll notice that the title of the field is
also added to report designer. Since we’ve already taken care of field header, just delete the
default added field header. Please make sure the final report designer layout looks similar to
Figure 10.
Figure 10: Final report design layout
7/27/2019 Crystal Report With Dataset
http://slidepdf.com/reader/full/crystal-report-with-dataset 5/5
That’s it. This is what we need for the design part. Now let’s write some cool C# code to bring
our report to life.