Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Visual Studio 2008 using Crystal Reports 2008

I'm trying to pass parameters to a Crystal Reports 2008 rpt file but keep getting a runtime message saying "Missing Parameter Values".

Has anyone experienced this problem?

Does anyone have a snippet of code where values are being passed from C#.Net to a crystal 2008 report.

Thanks in advance....

Former Member
replied

Hi Steven,

You can select version and download code samples from [here|https://boc.sdn.sap.com/codesamples]

Here is code for parameters :

{

string Reportpath = Server.MapPath("CrystalReport.rpt");

ParameterFields boParameterFeilds = new ParameterFields();

ParameterField boParameterFeild = new ParameterField();

ParameterValues boParametervalues = new ParameterValues() ;

ParameterDiscreteValue boParameterDiscreteValue = new ParameterDiscreteValue();

ParameterRangeValue boParameterRangeValue = new ParameterRangeValue();

CrystalReportViewer CR;

CR = new CrystalReportViewer();

CR.ReportSource = CrystalReportViewer1.ReportSource;

boParameterFeilds = CrystalReportViewer1.ParameterFieldInfo;

boParameterFeild = boParameterFeilds["Country"];

boParametervalues = boParameterFeild.CurrentValues;

boParameterDiscreteValue = new ParameterDiscreteValue();

boParameterDiscreteValue.Value = "Canada";

boParametervalues.Add(boParameterDiscreteValue);

boParameterDiscreteValue.Value = "USA";

boParametervalues.Add(boParameterDiscreteValue);

boParameterFeild = boParameterFeilds["sales"];

boParametervalues = boParameterFeild.CurrentValues;

boParameterRangeValue.EndValue = "10000";

boParameterRangeValue.StartValue = "25000";

boParametervalues.Add(boParameterRangeValue);

CrystalReportViewer1.ParameterFieldInfo = boParameterFeilds;

}

Hope this helps !!

Regards,

Shweta

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question