NOW

How to Use Crystal Report Step by step in Asp.net-c#

In this Post, I would like to explain the process of Creating Crystal Reports using Aspnet and C#


Step 1:Right click the solution Explorer and click on add new item

Step 2:Add a Crystal Report from the Dialogue box.

Step 3:Select the Radio Button(using the Report Wizard) from the Crystal Reports Gallery and choose a Standard Expert and click OK button.

Step 4:Here we have to add Database..Select the Create New connection from the available Datasources window and click OLEDB(ADO)

Step 5:select A new connection and then select a provider from the list (Microsoft OLEDB Provider for SQL Server)

Step 6:Enter the server name and select the Database and click the Integrated Security and press next and click finish button.

Step 7:Now,come back to Standard Report Creation Wizard and select the Table from the Database.

Step 8:Select the required fields to display in the Crystal Report from the table

Step 9:Select the style from the availble styles window (Ex:Standard) and Click Finish

Step 10:Now we have to add one WebForm from Add New Item and press Add.

Step 11:Here,we have to import two references that is

CrystalDecisions.CrystalReports.Engine

CrystalDecisions.Shared

Step12:Now,add one Crystal Report Viewer from the Toolbox

Step13:Now we have to import the following namespaces in the defalut.aspx.cs

using CrystalDecisions.CrystalReports.Engine;

using CrystalDecisions.Shared;

using System.Data.SqlClient;

Step14:Declare the variable ReportDocument  report = new ReportDocument();

Step15:Next,write the following code in the page Load Event

pt.Load(@"E:\practices\update\emp_details\crystalreports\CrystalReport.rpt");
crystalReportViewer1.ReportSource = report;
crystalReportViewer1.RefreshReport();



No comments