Click here to Skip to main content
15,670,482 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,

i am generating crystal report. i am using sql server 2008 and VS 2008. problem is that data isn't printing in report.
ReportDocument rptdoc = new ReportDocument();
private void bindreport()
    {
        con.Open();

        string filepath = Server.MapPath("~/")+"Reports/SampleCrystalReport.rpt";
        rptdoc.Load(filepath);
        
        DataTable dt = new DataTable();
        SqlCommand cmd = new SqlCommand("select * from tblEmp", con);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        da.Fill(dt);
        if (dt.Rows.Count != 0)
        {
            rptdoc.SetDataSource(dt);
            CrystalReportViewer1.ReportSource = rptdoc;
            CrystalReportViewer1.DataBind();
        }
        con.Close();
    }

i can get data at CrystalReportViewer1.ReportSource = rptdoc; but data can't display in report.

Thanks,
Krunal
Posted
Updated 10-Aug-11 23:32pm
v2
Comments
thatraja 11-Aug-11 6:00am    
Check the Datatable is contains data
thatraja 3-Dec-11 2:02am    
Still you didn't give me further details

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900