Email: Password:       Forgot Password 
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.

Crystal Report in ASP.NET

Viewed:  2147 
Posted On:  14/09/2014 00:06:04 
What is Crystal Report? How we can Crystal Report in C# step by step? 


In this article I am going to explain Crystal Report in ASP.NET. Below is my Employee Table which data I will show as report in ASP.NET using Crystal Report.


Image 1.

Now Open Visual Studio -> File -> New Web Site


Image 2.

After this Right Click on Solution Explorer -> Add New Item -> Crystal Report -> Add.


Image 3.


Image 4.

Here Expand -> Create New Connection -> Select OLE DB(ADO) -> A pop up window will open ->Select Microsoft OLE DB Provider for SQL Server -> Next


Image 5.

Now Enter your SQL Server Details.


Image 6.


Image 7.

Now Select your Data Base -> Select Your Table and Move


Image 8.

Now Select those column which you want to show in reports. Click Finish.


Image 9.

Now you can see your report is ready. All Columns already in Details sections. You can remove any column or you can add new column by drag n drop from field explorer to report.


Image 10.

Now time to add a Report Viewer where we can show this Crystal Report. On Default.aspx page, drag n drop CrystalReportViewer from tool box like below.


Image 11.

Now on Page_Load event write below code:

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CrystalDecisions.CrystalReports.Engine;
public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        ReportDocument crystalRpt = new ReportDocument();
        CrystalReportViewer1.ReportSource = crystalRpt ;        

Now Run your Application:


Image 12.

         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us