[RESOLVED] Passing Params to Crystal Reports
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: [RESOLVED] Passing Params to Crystal Reports

  1. #1
    Join Date
    May 2011

    [RESOLVED] Passing Params to Crystal Reports

    I'm creating a new Crystal Report. The binding is done via Dataset and it accepts params. We have existing code that applies params. These existing reports bind directly to a SPROC and they have Params that go to the SPROC and some that are just local to the report.

    However, with the Dataset report, i keep getting an error "Missing parameter values" when trying to export the report to PDF.

    I've tried removing ALL params and executing the report and it works just fine. Once I added a param to the report, i start seeing this error.

    here is the code snippet of how the params are being set.

     reportPath = reportPath + "\\" + this.Code + ".rpt";
     _crystalReport.Load(reportPath, OpenReportMethod.OpenReportByTempCopy);
     ParameterField paramField = new ParameterField();
     ParameterDiscreteValue discreteVal;
      _crystalReport.SummaryInfo.ReportTitle = this.Name;
       _crystalReport.SummaryInfo.ReportComments = "";
       for (int i = 0; i < _crystalReport.DataDefinition.ParameterFields.Count; i++)
            ParameterFieldDefinition p = _crystalReport.DataDefinition.ParameterFields[i];
            if (p.IsLinked())
            string strValue = "";
            strValue = GetReportValue(p.Name, reportParameters);
            paramField = new ParameterField();
            discreteVal = new ParameterDiscreteValue();
             paramField.ParameterFieldName = p.Name;
             if (strValue != "" || p.Name == "ColdStorageLine")
                     discreteVal.Value = strValue;
    Any input would be greatly appreciated.
    Last edited by shollon; July 19th, 2011 at 12:41 PM.

  2. #2
    Join Date
    May 2011

    Re: [RESOLVED] Passing Params to Crystal Reports

    Apparently, you have to set the Datasource BEFORE you apply the parameters. Setting the datasource beforehand apparently clears the params.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)