Karthik K

Karthik K

  • 1k
  • 738
  • 192.4k

Load Report failed. In Crytal Report .. How to solve . ?

Jan 2 2018 3:14 AM
Hi All ,
 
I am using crystal report in vs 2008 . When I load the report in cystal viewer.
 
its shows like Load report failed exception
 
* I have checked the sql authentication. That's also correct. I am sharing my code.
 
anybody knows suggest me with example ..
 
Sample Code :
  1. public void loadcry(string DCNO,string VID)  
  2. {  
  3. TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();  
  4. TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();  
  5. ConnectionInfo crConnectionInfo = new ConnectionInfo();  
  6. Tables CrTables;  
  7. string q2="SELECT * FROM VIEW_DCREPORT WHERE DCNO="+DCNO +" AND VID="+VID +"";  
  8. Ds = SqlObj.GetData_DS(q2);  
  9. rep = new ReportDocument();  
  10. rep.Load(Server.MapPath("~/DCRPT.rpt"));  
  11. rep.SetDataSource(Ds.Tables[0]);  
  12. CrTables = rep.Database.Tables;  
  13. foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)  
  14. {  
  15. crtableLogoninfo = CrTable.LogOnInfo;  
  16. crtableLogoninfo.ConnectionInfo = crConnectionInfo;  
  17. CrTable.ApplyLogOnInfo(crtableLogoninfo);  
  18. }  
  19. rep.Refresh();  
  20. CrystalReportViewer1.ReportSource = rep;  
  21. Session["Report"] = rep;  
  22. CrystalReportViewer1.DataBind();  
  23. CrystalReportViewer1.RefreshReport();  
  24. }  
Thanks in advance ,
Karthik k

Answers (6)