Why Use Crystal Reports?

Crystal Reports is the integrated reporting tool in Visual Studio .NET. Based on the type of application you're developing—desktop or Web-based—Crystal provides report viewers that integrate into forms to display reports built with the Crystal Reports designer.

For simple reporting, you can bind a report to a viewer and just display it or you can use the rich object model that Crystal exposes to completely control the customization of your reports. Using the Crystal Reports designer is by far the easiest way to create reports out of the box with Visual Studio .NET. In addition to great support for Web Form viewers and Windows Forms viewers, you can also expose Crystal reports as XML Web services. When a report is exposed as a Web service, the caller of the Web service gets the XML representation of the report. This is immensely useful for complex data where it might be easier to use a wizard in Crystal to create a report than it would be to write the database code to generate the correct XML schema information.

When creating reports, you have the option of pulling data from a data source to the report or pushing data from a data source to the report. In the pull model, the database drivers connect to the data source and pull data dynamically. In the pull model, you can design a report and bind it to a viewer at design time. When the report is viewed at runtime, the data is pulled from the data source. The Crystal engine handles the connection details and the actual pulling of the data; no additional code is needed from you. An example of a good pull-model scenario is monthly or quarterly sales data: After the aggregate formulas have been created, the report definition never changes and Crystal can handle getting the data on demand when needed.

In the push model, you write the database connection code; that is, the code that fills the data source with data, and then passes the data to the report. The push model is more flexible than the pull model because you normally design reports on a development machine, and the connection details might change at runtime. In that case, you can specify connection information in the Web.Config file or any application configuration file, and dynamically create the data source at runtime. An example of a push model report is Customer Orders By ID, where the ID of the customer can be different each time the report is called. You just pass parameters to the report, and dynamically build the data source at runtime.

When designing reports, you have the option of using the following data sources:

  • ADO.NET dataset

  • OLEDB data source

  • Microsoft Access database

  • Microsoft Excel spreadsheet

  • Crystal Data Objects

If you're using MSDE or SQL Server databases, the logical choice is to use ADO.NET datasets to push data to a report.

After you've determined the data source of the report, you add different fields to the report to represent your data. As with the full version of Crystal Reports, the Visual Studio .NET version supports bound database fields, formula fields, parameter fields, custom groups, summary fields, running totals, subreports, and custom charts. Based on the type of report you're using, you add various fields to different areas of the report in the report designer to customize your data output.

Now that you understand the basics on what Crystal is, you can start writing your first Crystal Report in Visual Studio .NET.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.150.231