0
Reply

Load report failed

Minh

Minh

Nov 26 2010 12:50 PM
12k
Hi friends, I tried two ways to create a crystal report :
The first, i create a class of report programmatically and give it resourcename="rpt1.rpt", fullresourcename="report.rpt1.rpt"
The second , i create a class of report manually : rpt1.rpt (full path  : report/rpt1.rpt)
They seem to be same but the result is not .
In way 1 , error is returned with  : Report load failed
In way 2 , report is successful .

So , can you give me the key that lead to the difference here .
Thanks so much .

---------------------------------------------------------------------------------------------------------------------------------------------------------

cReport = "rpt1.rpt";                
                SqlConnection cnnt = Class.ConnectDatabase.CreateConnection();
                string sl = "Select * from tb_sanpham";
                SqlDataAdapter data = new SqlDataAdapter(sl, cnnt);
                DataSet ds = new DataSet();
                data.Fill(ds);
                this.ds = ds;           
//-----------------------------------------------------------1------------------------------------------------------------
                CrystalDecisions.CrystalReports.Engine.ReportClass oReport = new                       CrystalDecisions.CrystalReports.Engine.ReportClass();                                                
                oReport.ResourceName = cReport;
                oReport.FullResourceName = "ASIANSTAR.Report.rpt1.rpt";
                oReport.SetDataSource(ds.Tables[0]);
                cReportViewer.ReportSource =oReport;               
//--------------------------------------------------------end of 1-----------------------------------------------------------
//-----------------------------------------------------------2----------------------------------------------------------------
                Report.rpt1 repo = new ASIANSTAR.Report.rpt1();
                repo.SetDataSource(ds.Tables[0]);
                cReportViewer.ReportSource = repo;   
//----------------------------------------------------end of 2----------------------------------------------------------------