The Add WHERE Clause dialog box enables you to further define a SELECT statement of a SQL data source by specifying search conditions that restrict the rows returned.
You can add one or more search conditions to a WHERE clause. For each search condition, you can specify either a literal or a parameterized value. Parameterized values allow you to bind to application variables, user identities and choices, and other data.
-
Column
-
This element specifies which data column to use in the WHERE clause search condition. The value selected from the drop-down list becomes the left side of the search condition.
-
Operator
-
This element specifies what operator to use in the WHERE clause search condition. The operators you can select depend on the data column definition. For data columns defined as integers, the choices are equals (=), less than (<), greater than (>), less than or equal to (<=), greater than or equal to (>=), or not equal to (<>). For data columns that allow null values, IS NULL and IS NOT NULL are also available choices. For data columns that are defined as character data types, LIKE and NOT LIKE are available.
-
Source
-
This element specifies what source to use in the WHERE clause search condition. The selected source becomes the right side of the search condition. The choices are None, Control, Cookie, Form, Profile, QueryString, and Session.
Selecting None indicates that a literal value will be used in the search condition. In this case, the Parameter Properties element will show only a Value field.
Selecting any of the other Source values indicates that a parameterized value will be used in the search condition. In this case, the Parameter Properties element will show two fields.
-
Parameter Properties
-
This element allows you to set the parameter properties of the search condition. What shows up in the Parameter Properties element depends on what Source you selected, as shown in the following table.
|
Source
|
Parameter properties
|
|
None
|
Value
|
|
Control
|
Control ID
Default value
|
|
Cookie
|
Cookie name
Default value
|
|
Form
|
Form field
Default value
|
|
Profile
|
Profile name
Default value
|
|
QueryString
|
QueryString field
Default value
|
|
Session
|
Session field
Default value
|
Each source results in a different Parameter control in the ParameterCollection of the SqlDataSource control, as shown in the following table.
-
SQL Expression
-
This element shows the result of the search condition currently being configured.
-
Value
-
This element shows the value that the search condition must satisfy. The Value maps to the DefaultValue property of the Parameter control.
-
WHERE clause
-
This element shows the result of the WHERE clause composed of search conditions. Use the Add and Remove buttons to add a new search condition or remove an existing search condition, respectively.
-
Add
-
The Add button adds the configured search condition to the WHERE clause. The Add button is enabled only if the search condition is fully specified.
-
Remove
-
The Remove button removes the selected search condition in the WHERE clause element. The Remove button is enabled only if the WHERE clause contains at least one search condition.