Sunday, January 16, 2011

The report you requested requires further information

This issue is a common one who starts working on Crystal Reports with Dataset (.Net)

loginerror

 

Ill show a sample code snippet where you can generate this issue.

                 ReportDocument report = new ReportDocument();    

BAgent bAgent = new BAgent();
DataSet dsStatus = new DataSet();
dsStatus = bAgent.GetStatus();

string reportPath = Server.MapPath("/Agent/Reports/GetStatusRpt.rpt");
report.Load(reportPath);

report.SetDataSource(dsStatus);// this is the line cause for this issue
CrystalReportViewer1.ReportSource = report;
CrystalReportViewer1.DataBind();
CrystalReportViewer1.RefreshReport();
 



Here is the solution, use the datset table instead of the dataset


 

                 ReportDocument report = new ReportDocument();    

BAgent bAgent = new BAgent();
DataSet dsStatus = new DataSet();
dsStatus = bAgent.GetStatus();

string reportPath = Server.MapPath("/Agent/Reports/GetStatusRpt.rpt");
report.Load(reportPath);
                 report.SetDataSource(dsStatus.Tables[0]); 
CrystalReportViewer1.ReportSource = report;
CrystalReportViewer1.DataBind();
CrystalReportViewer1.RefreshReport();

 


Hope you got rid from this issue. Enjoy coding.

2 comments:

Nishant said...

but what is the namespace for ReportDocument and BAgent???

Sheen said...

namespace you can get by right clicking on the ReportDocument and press resolve but Ill metion what it is CrystalDecisions.CrystalReports.Engine.ReportDocument

BAgent is one of my class I used in my application

My Achievements

Member of

Blog Archive

Followers