Asp.Net Crystal Report From XML File

Crystal Report From XML

To Generate Crystal Report From XML File in Asp.Net use followinf  code

Here Report.XML is an XML file in application

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;

public partial class _Default : System.Web.UI.Page
CrystalDecisions.Web.Report rpt = new CrystalDecisions.Web.Report();
CrystalDecisions.CrystalReports.Engine.ReportDocument rpt1;

protected void Page_Load(object sender, EventArgs e)
SqlConnection myConnection = new SqlConnection(“Data Source=SWAMI\\SQLEXPRESS;Initial Catalog=gifts;Integrated Security=True”);

string str = “select * from order_master where userid=’HetaDave'”;

SqlDataAdapter da = new SqlDataAdapter(str,myConnection );
DataSet ds = new DataSet();

rpt.FileName = Server.MapPath(“CrystalReport.rpt”);
crdata.Report = rpt;

rpt1 = crdata.ReportDocument;

crp.ReportSource = rpt1;



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s