Accessibility
 
Home > Products > UltraDev > Support > Building Common Applications
Dreamweaver UltraDev Icon Macromedia Dreamweaver UltraDev Support Center - Building Common Applications
Including records based on the equality of two values

The previous section described how to define the columns of a recordset using SQL. This section describe how to include records (rows) in that recordset based on the equality of a search parameter's value with a record column's value.

Suppose you decide to let users search the database by department. The following logic is required to build the results recordset:

Check a record in the database table.
If the value in the "department" column of the record is equal to the department name submitted by the user, then include that record in the results recordset.
Check the next record in the table.

You can express this logic in SQL using a WHERE clause, as follows:

WHERE ColumnName = ParameterValue

ParameterValue is a SQL variable containing a search parameter. For more information, see Placing the search parameters in SQL variables.

In the SQL box in Recordset dialog box, enter the WHERE clause defining your search condition. If the variable is a text value, enclose the variable name in single quotes.

Here's how this type of search condition can be expressed in the Recordset dialog box:

When executed, the SQL statement finds all the records in the employee table with a DEPARTMENT value equal to the value contained in the varDept variable. For example, if the user specifies Operations as the department name, the database query above might generate the following recordset:

To test the search condition without exiting the Recordset dialog box, enter a known value (such as Operations) for the variable in the Default Value column in the Variables area, then click Test. UltraDev generates a test recordset based on the SQL statement and the default value of the variable. The default value simulates a search parameter entered by a user.

Leave the Recordset dialog box open for now. You'll use it in the next section to define another kind of search condition, one based on the likeness of a search parameter's value with a record column's value.

To Table of Contents Back to Previous document Forward to next document