you need to create the
.rpt first and then load it to
ReportDocument
Try this :
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument crypt = new ReportDocument();
CrystalReportViewer1.Visible = true;
DataSet ds = new DataSet("DataSet1");
DataTable table = new DataTable("DataSet1");
table.Columns.Add("username", typeof(System.String));
table.Columns.Add("bookno", typeof(System.String));
DataRow row = table.NewRow();
row["username"] = "Farooq";
row["bookno"] = "hyden";
ReportDocument crypt = new ReportDocument();
string path="D:\\Projects\\CrystalDemo\\CrystalDemo\\CrystalReport1.rpt";
crypt.Load(path);
crypt.SetDataSource(ds);
crystalReportViewer1.ReportSource = crypt;
crystalReportViewer1.Refresh();
}
for more details check
THIS[
^]
hope it helps :)