Crystal report binding error
Am getting error that The type or namespace name 'CrystalReportViewer' does not exist in the namespace 'CrystalDecisions.Web'.. pls suggest me sol..
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Jan 1, 2014, 6:53 AM
using System.Collections;
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 System.Data.SqlClient;
using CrystalDecisions.CrystalReports.Engine;
namespace ReportViewer
{
public partial class _Default : System.Web.UI.Page
{
string connStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlDataAdapter sqlda = new SqlDataAdapter();
SqlCommand com = new SqlCommand();
DataTable dt;
DataSet1 ds=new DataSet1();
ReportDocument rptDoc=new ReportDocument();
protected void Page_Load(object sender, EventArgs e)
{
bindReport();
}
private void bindReport()
{
SqlConnection conn = new SqlConnection(connStr);
dt = new DataTable();
dt.TableName = "Crystal Report Example";
com.Connection = conn;
com.CommandText = "SELECT * FROM product";
sqlda = new SqlDataAdapter(com);
sqlda.Fill(dt);
ds.Tables[0].Merge(dt);
rptDoc.Load(Server.MapPath("CrystalReport1.rpt"));
rptDoc.SetDataSource(ds);
CrystalReportViewer1.ReportSource = rptDoc;
}
}
}