Accessibility
 
Home > Products > UltraDev > Support > Building Common Applications
Dreamweaver UltraDev Icon Macromedia Dreamweaver UltraDev Support Center - Building Common Applications
Placing the search parameters in SQL variables

The parameter values sent by the search page are initially stored in memory by your application server. You must extract these values from memory and place them in SQL variables so that you can use them in a SQL statement. In UltraDev, you use SQL (Structured Query Language) to write a database query that generates the results recordset, which you can then display on the results page. (Writing queries and displaying results are covered in later sections of this article.)

This section describes how to place search parameters in SQL variables so you can use them in a SQL statement later on.

Your application server stores search parameters in the memory when it receives them from the search page. You can access these parameters if you know the name of the HTML form object associated with each search parameter. For example, suppose a form object used on the search page is a list/menu called mnuDept. Depending on your application server, you can access the value of the parameter with the following expression:

Application Server Expression
ASP Request("mnuDept")
JSP request.getParameter("mnuDept")
ColdFusion #mnuDept#

To create a SQL variable and assign a search parameter to it:

1 Open the results page and display the Recordset dialog box by opening the Data Bindings panel (Window > Data Bindings), clicking the plus (+) button, and selecting Recordset (Query) from the pop-up menu.
If the simple Recordset dialog box appears, switch to the advanced Recordset dialog box by clicking the Advanced button. Here's what the advanced Recordset dialog box looks like.
2 In the Recordset dialog box, click the plus (+) button in the Variables area.
3 In the Name column, enter the name of the variable.
This is the name that will appear in the SQL statement.
4 In the Default Value column, enter a value to be used in case the HTML form does not submit a value for the search parameter (for example, the user leaves a field blank).
5 In the Run-time Value column, enter the search parameter's value expressed in terms of the value stored by the application server.
For example, for an JSP application server, enter the following:
request.getParameter("FormObjectName")
6 Leave the Recordset dialog box open for now.
You'll use the dialog box next to write the SQL statement defining the results recordset, as described in the next sections.
The Variables area of the Recordset dialog box should look as follows:
The Default Value, %, is a standard SQL wildcard for a character or a string of characters.

After placing the search parameters in SQL variables, you can use them in a SQL statement. The following sections describe how to write such statements.

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