SAP Knowledge Base Article - Public

1682140 - Error: No valid report source is available - when connecting an SAP Crystal Report to an ADO .NET dataset

Symptom

  • An SAP Crystal Report is connection to an ADO .NET Dataset in an web application:
CrystalReportDocument.SetDataSource(dataSet)
  • Using the <next> button to navigate to next page of the report results in the error:

No valid report source is available

Environment

  • Crystal Reports for Visual Studio 2010
  • Visual Studio 2010

Cause

  • Paging through the report in a web application results in postbacks to the application server
  • This may result in loss of focus on the report object

Resolution

  • Store the report in Session and then use the report suorce from the session on page postback:
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
try
{
CrystalReportViewer1.ReportSource = (ReportDocument)Session\"Report\";
CrystalReportViewer1.RefreshReport();
}
catch (Exception ex)
{

 

Keywords

  CR2010 2010 CR4VS2010 CR4VS VS2010 NET2010 Crystal Reports for .NET Framework 4.0 crforvs 13 post back page paging , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports, developer version for Microsoft Visual Studio