Parameter Collection Editor Dialog Box

Enables you to create and configure parameters for SQL queries, business object methods, or filtering expressions associated with the ObjectDataSource, SqlDataSource, and AccessDataSource data source controls. Parameter objects are evaluated at run time, to bind the values of the variables they represent to methods used by data source controls to interact with data. Parameter objects are contained in a ParameterCollection object.

Tasks

Editing the Parameter Collection

The Parameter Collection Editor dialog box is displayed when you are using the Properties window to configure an ObjectDataSource, SqlDataSource, or AccessDataSource control in Design view.

Select the SqlDataSource or AccessDataSource control on the design surface, and then select the FilterParameters property in the Properties window to open the Parameter Collection Editor dialog box. For the ObjectDataSource control, select the DeleteParameters, FilterParameters, SelectParameters, and UpdateParameters properties in the Properties window to open the Parameter Collection Editor dialog box.

Parameter Naming

The statements or stored procedures in the Parameter Collection Editor dialog box can be defined with parameter placeholders. Because different database products use different varieties of SQL, the syntax of the SQL string depends on the current ADO.NET provider being used, which is identified by the ProviderName property. If the SQL string is a parameterized query or command, the placeholder of the parameter also depends on the ADO.NET provider being used. For example, if the provider is the System.Data.SqlClient namespace, which is the default provider for the SqlDataSource class, the placeholder of the parameter is @parameterName. However, if the provider is set to the System.Data.Odbc or System.Data.OleDb namespace, the placeholder of the parameter is ?. For more information about parameterized SQL queries and commands, see Using Parameters with the SqlDataSource Control.

Adding Parameters

The Parameters collection for a command (for example, Parameters) contains a list of parameter objects that are used at run time to pass values to the statements or stored procedures. Thus, there is a parameter object for each parameter value that needs to be passed to a command.

The editor is divided into two panes. In the left pane you add and remove parameters, and in the right pane you set properties for individual parameters, among them:

UI Elements

  • Parameters
    Shows the parameters currently in the parameter collection.

  • Add Parameter
    Creates a new parameter in the collection. By default, the parameter is named newparameter. Select the name of the parameter to change it.

    You can rearrange parameters by clicking the appropriate buttons, as shown in the following table.

    To

    Click this button

    Move a parameter up in the hierarchy

    Move Up Button

    Move a parameter down in the hierarchy

    Move Down Button

    Delete a parameter from the hierarchy

    Delete Button
  • Parameter Source
    Specifies the data source for the parameter. Each source results in a different Parameter control in the ParameterCollection. The choices are as shown in the following table

    Source

    Resulting parameter

    None

    Parameter

    Control

    ControlParameter

    Cookie

    CookieParameter

    Form

    FormParameter

    Field

    ProfileParameter

    QueryString

    QueryStringParameter

    Session

    SessionParameter

  • Show advanced properties
    Shows the advanced properties of the currently selected parameter.

  • Properties
    Shows the properties of the Parameter control.

  • Hide advanced properties
    Hides the advanced properties of the currently selected parameter.

See Also

Concepts

Using Parameters with the SqlDataSource Control

Reference

Parameter