Hardik Patel

Hardik Patel

  • NA
  • 378
  • 469.5k

error in code for crystal report in vs 2010

Oct 18 2013 7:43 AM
i am using below code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Configuration;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.IO;

public partial class _Default : System.Web.UI.Page
{
    conn ObjConn = new conn();
    protected void Page_Load(object sender, EventArgs e)
    {
      
       
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();
        string str = "select * from Register";
        dt = ObjConn.GetDataTable(str);
        DataSet ds = new DataSet("table");
        ds.Tables.Add(dt);
        ReportViewer1.Visible = true;
        ReportDocument rDoc = new ReportDocument();
        dt.TableName = "Crystal Report ";  // Crystal Report Name
        rDoc.Load(Server.MapPath("userrpt.rpt")); // Your .rpt file path
        rDoc.SetDataSource(ds); //set dataset to the report viewer.
        ReportViewer1.ReportSource = rDoc;   // which  name space i have to use for this 
    }
}

Answers (1)