Sunday, January 16, 2011
The report you requested requires further information
2:24 PM |
Posted by
Sheen |
Edit Post
This issue is a common one who starts working on Crystal Reports with Dataset (.Net)
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.
Subscribe to:
Post Comments (Atom)
4 comments:
but what is the namespace for ReportDocument and BAgent???
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
The solution that you gave it solved my problem.
Thank you.
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
Post a Comment