http://www.aspsnippets.com/articles/crystal-report-aspnet-example-using-dataset-or-datatable-in-c-vbnet-and-visual-studio-2010.aspx
I followed above link to create sample Crystal Report Project. Here is my code:
string conStr = ConfigurationManager.ConnectionStrings["MasterDb"].ConnectionString.ToString();
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument crystalReport = new ReportDocument();
crystalReport.Load(Server.MapPath("~/CrystalReport1.rpt"));
DataSet1 ds = GetData();
crystalReport.SetDataSource(ds);
CrystalReportViewer1.ReportSource = crystalReport;
}
public DataSet1 GetData()
{
SqlConnection con = new SqlConnection(conStr);
SqlCommand cmd = new SqlCommand("Select * from Customer");
using (SqlDataAdapter adapter = new SqlDataAdapter())
{
cmd.Connection = con;
adapter.SelectCommand = cmd;
con.Open();
using (DataSet1 ds = new DataSet1())
{
adapter.Fill(ds, "DataTable1");
return ds;
}
}
}
<div>
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True"/>
</div>
When I run my project, blank page renders. No Crystal report is displayed.
Please help me where I am wrong