1812388 - ReportDocument is not able to retrieve Stored Procedure parameter by index from a report

SAP Knowledge Base Article - Public

1812388 - ReportDocument is not able to retrieve Stored Procedure parameter by index from a report

Symptom

  • Original behavior (RTM) returned parameters by index in the order as these appeared in the Crystal Reports designer
  • Using Service Pack 3 for Crystal Reports for Visual Studio 2010 requires the code to compare parameters by name field

Environment

  • SAP Crystal Reports for Visual Studio 2010
  • Visual Studio 2010

Reproducing the Issue

  1. Install Crystal Reports for Visual Studio 2010, Service Pack 3 (SP 3)
  2. Create a report with Stored Procedure parameters
  3. Use the following code that used to work before SP 3:
    private void ReportDocumentSetParameters(CrystalDecisions.CrystalReports .Engine.ReportDocument rpt)
             {
                 foreach (CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition pField in (ParameterFieldDefinitions)rpt.DataDefinition.ParameterFields)
                     {
                         switch (pField.Name)
             {
                 case "@st":
                     {
                         SetCrystalParam(rpt, "@st", "184");
                     }
                     break;
                 case "@sg":
                     { SetCrystalParam(rpt, "@sg", "1,1");
                     }
                     break;
                 case "@si":
                     {                SetCrystalParam(rpt, "@si", null);
                     }
                     break;
                 case "@sd":       {
                         SetCrystalParam(rpt, "@sd", "4/1/1825 00:00:00");
                     }
                     break;      
                 case "@ed":
                     {
                         SetCrystalParam(rpt, "@ed", "4/1/2012 00:00:00");
                     }              
                     break;
                 case "@Range":
                     {
                         SetCrystalParam(rpt, "@Range", "M");               
                     }
                     break;
                 case "@uid":
                     {
                         SetCrystalParam(rpt, "@uid", "3");
                     }
                     break;
                 case "@rid":
                     { 
                         SetCrystalParam(rpt, "@rid", "6");
                     }
                     break;
             }
         }

 

Resolution

Issue has been tracked under ADAPT01648035 and & ADAPT01623452 and is resolved in Service Pack 5

Keywords

CR2010 2010 CR4VS2010 CR4VS VS2010 NET2010 Crystal Reports for .NET Framework 4.0 crforvs 13 2012 , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , Problem

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio