How to assign values to parameter fields of the asp.net Crystal Report in the code, asp.net CRYSTAL REPORT

Source: Internet
Author: User

How to assign values to parameter fields of the asp.net Crystal Report in the code, asp.net CRYSTAL REPORT

This document describes how to assign values to parameters of the asp.net Crystal Report in the code. Share it with you for your reference. The specific implementation method is as follows:

// 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 be consistent with the parameters in the report. ParamField. ParameterFieldName = "Customer ID"; // set the start and end values 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;

The following are my applications:

Public void OnePage (CrystalReportViewer crystalReportViewer, int a) {ParameterFields paramFields = new ParameterFields (); ParameterField paramField = new ParameterField (); ParameterDiscreteValue discreteVal = new release (); // 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 = "ARC_ I _ID"; // set the discrete value and pass it to this parameter. DiscreteVal. Value = id; paramField. CurrentValues. Add (discreteVal); // Add this parameter to the parameter field set. ParamFields. Add (paramField); // put the set of parameter fields into the viewer control. CrystalReportViewer. ParameterFieldInfo = paramFields ;}

The first code has two parameter fields, and the second code has a parameter field.

I hope this article will help you design your asp.net program.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.