05-03-2012, 04:43 PM
Crystal Reports For Visual Studio .NET
[attachment=18009]
Introduction
Crystal Reports for Visual Studio .NET supports reports that access ADO.NET datasets.
You can create an ADO.NET dataset from a variety of sources. Whatever the source is,
before you can report off an ADO.NET dataset, you must first generate an object for the
dataset. Subsequently, you can use a Report Expert in Crystal Reports for Visual Studio
.NET to create a new report based on the data description provided by the dataset object.
A dataset object generated with the Visual Studio ADO.NET Dataset Designer contains only
the data description, and not the actual data. Consequently, when working with a report
connected to such a dataset object, you cannot browse field data in the Crystal Report
Designer at design time.
Creating a Dataset Object from a Database
You can create an ADO.NET dataset from various data sources (including Access, Oracle,
and SQL Server databases) by using the Visual Studio ADO.NET Dataset Designer. The
ADO.NET Dataset Designer shows a graphic view of the database with its tables, its fields,
and their corresponding types. You can drag tables from the Server Explorer to a schema
file in the DataSet tab of the Designer. In this walkthrough, you will create a schema file for
the project, ADONETWalkthrough, based on the Access sample database, xtreme.mdb,
which has been automatically installed during setup at c:\Program Files\Microsoft Visual
Studio .NET\Crystal Reports\Samples\Database (assuming c: is the drive where Visual
Studio .NET has been installed).
Setting Up an ADO.NET Report in a Web Forms
Viewer
To specify xtreme.mdb as the database and bind CustomerSales.rpt to a Web
Forms Viewer
1. Highlight WebForm1.aspx in the Solution Explorer. Then click the View Code icon.
This opens the source file for the Web Form, WebForm1.aspx.cs.
2. In WebForm1.aspx.cs, type at the beginning of the namespace definition:
using System.Data.OleDb;
3. At the beginning of the class definition for WebForm1, type:
public CustomerSales oRpt = null;