// Declare the variables required to pass parameters to the viewer control. ParameterFields paramFields = new ParameterFields (); ParameterField paramField = new ParameterField (); ParameterDiscreteValue discreteVal = new ParameterDiscreteValue (); ParameterRangeValue rangeVal = new ParameterRangeValue (); // The first parameter is a discrete parameter with multiple values. Set the parameter field name, which must be consistent with the parameters in the report. ParamField. ParameterFieldName = "customer name "; // Set the first discrete value and pass it to this parameter. DiscreteVal. Value = "AIC Childrens "; ParamField. CurrentValues. Add (discreteVal ); // Set the second discrete value and pass it to this parameter. The discreteVal variable is set as a new value, so that the previous settings will not be overwritten. DiscreteVal = new ParameterDiscreteValue (); DiscreteVal. Value = "Aruba Sport "; ParamField. CurrentValues. Add (discreteVal ); // Add this parameter to the parameter field set. ParamFields. Add (paramField ); // The second parameter is the region value. The paramField variable is set as a new value, so that the previous settings will not be overwritten. ParamField = new ParameterField (); // Set the parameter field name, which must match the parameters in the report. ParamField. ParameterFieldName = "Customer ID "; // Set the start value and end value of the range and pass the range to this parameter. RangeVal. StartValue = 42; RangeVal. EndValue = 72; ParamField. CurrentValues. Add (rangeVal ); // Add the second parameter to the parameter field set. ParamFields. Add (paramField ); // Put the set of parameter fields into the viewer control. CrystalReportViewer1.ParameterFieldInfo = paramFields; |