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.

5 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

Hekuran said...

The solution that you gave it solved my problem.

Thank you.

G S Lakmal said...

Good job

Sherihan said...

I can view my crystal report without any issue. but when i click print button of the crystal report tool bar, this error comes.it blocks the printing format to be viewed. need help

My Achievements

Member of

Blog Archive

Followers