Crystal Report using in DotNet

Hi all,

I am going to explain how to create a report by using Crystal Report in DotNet here.

Generating Report:
----------------------


To create a report using crystal report, just follow the steps mentioned below which is very useful to using crystal repot.

In Visual Studio 2005, create new project with a name as your wish. Add a new item to the project by right clicking on the project name in solution explorer. Select the crystal report template with a name as your wish.

Now you are in Crystal Report Gallery dialog. Now you should choose the “Using the Report Wizard” and “Standard” options and click OK.

The Standard Report Creation Wizard dialog will appear. Now you should choose the data source to connect SQL Server 2005. For that just expand the Create New Connection data source and expand the OLEDB(ADO) item. Then select an OLEDB provider “SQL Native Client” for SQL Server 2005 databases.

Now we need to provide the connection information for the database. Type the server name and check the Integrity Security checkbox. Then click the dropdown list next to the database item and select the database. Click the next to continue, in next dialog finish to configuring the data source.

Now you need to choose the tables to use for the report. Expand your database and select the tables by using > button.

Click the next to continue. Here you need to confirm the relationships between the various tables you have selected. Then click the next to continue.

Now you should choose the fields to use for the report by using > button. Then click next, in the next dialog you should choose the field to group the report.

Clicks next to continue there will three dialogs seemed. Just give next and next, in final dialog you can select report style finally click finish then your report will be ready.
Previewing Report:
---------------------

After creating the report, you can preview that by clicking the Main Report Preview button which is in the bottom of report.

Viewing your Report in Windows Form:
--------------------------------------------


If you want to see the report in windows form, you will need to use the CrystalReportViewer control.

First you will need to add a new windows form to the project. And add the CrystalReportViewer control in to your form. Now add a button control in to form and named it as “ViewReport”.

Then write code as below in the button clicked event.

CrystalReport1 report = new CrystalReport1();
{
Form2.CrystalReportViewer1.ReportSource = report;
Form2.ShowDialog();
}


...S.VinothkumaR.

6 comments:

gokul said...

Ur article is very nice.. I understand how to create a crystal report in dotnet in the first attempt itself. Good work. Thank U.

Surekha said...

Ur article is very understandable.I understand how to create a crystal report in dotnet in the first attempt itself. Good work. Can you explain different type of creation of crystal reports also i mean much higher level.
Thank you

Ankit........The Great said...

sir may you teach me creating crystal report actually i did as you wrote but hv a problem...

Vinothkumar S said...

Thanks to all for your comments. Its really help me to do more.

Vivek Saggu said...

please do not write these kind of silly articles. Even a kid can do this

Hifni Shahzard Nazeer said...

Your article is an elementary one yet a good one for a newbee . Any idea how to create a master report where any changes to master will apply to child reports?