Setting Parameters
When you create a Crystal report, data selection for the report is controlled by the "where" criteria. The value for the "where" criteria can be a hard-coded value. But when the value must be dynamic, a parameter is created and the "where" clause is assigned to the parameter. Parameters are handled differently, depending on whether you develop with a coding model or a reduced-code model.
When you develop with a coding model, Crystal Reports for Visual Studio accesses and interacts with parameters through a group of parameter-related classes in the Crystal Reports SDK.
When you develop with a reduced-code model (the tag-based application model), the CrystalReportSource control accesses and interacts with parameters through use of the Parameters framework. The Parameters framework is new to ASP.NET version 2.0. It allows parameters to be assigned to any DataSource control (in this case, a CrystalReportSource control.) These parameters can be assigned to both the main report and any subreport, should they require parameters.
A parameter is assigned from any of the following parameter types:
- ControlParameter
- QueryStringParameter
- SessionParameter
- FormParameter
- CookieParameter
This parameter assignment enables you to create a reduced-code solution, where a report's parameters can be set from selections made in DropDownList controls (or other types of controls), values in the URL query string, values retrieved from Session, posted values from form fields, or values from a Cookie.
Setting Parameters Directly in the XML
In XML, the <Parameters> tag is nested within the <CrystalReportSource> tag. Within the nested <Parameters> tag, links to a default parameter or a parameter from a control can be configured.
Setting Parameters Programmatically
The coding model of the Crystal Reports SDK has always been capable of setting parameters. For more information, see Tutorial: Reading and Setting Discrete Parameters and Tutorial: Reading and Setting Discrete Parameters.
To access the Parameter Collection Editor dialog box
Parameters are configured in the Parameter Collection Editor dialog box.
Select the CrystalReportSource control.
From Properties, expand Report.
Within the Report property, click the ellipsis ( ...) on the far right of Parameters (Collection).
In the Parameters Collection Editor dialog box, enter one or more parameters for the main report, as well as for any sub reports.
> [!NOTE]
> <P>For detailed instructions on configuring this dialog box, see the tutorial <A href="ms227796(v=vs.90).md">Reduced-Code Secure Database Logon in a Web Site</A>.</P>