beautypg.com

Adobe Dreamweaver CS3 User Manual

Page 635

background image

DREAMWEAVER CS3

User Guide

628

4

Enter a Select statement in the SQL text area.

Make sure the statement includes a WHERE clause with variables to hold the search parameters. In the following
example, the variables are called

varLastName

and

varDept

:

SELECT EMPLOYEEID, FIRSTNAME, LASTNAME, DEPARTMENT, EXTENSION ¬

FROM EMPLOYEE WHERE LASTNAME LIKE 'varLastName' AND DEPARTMENT ¬

LIKE 'varDept'

To reduce the amount of typing, you can use the tree of database items at the bottom of the advanced Recordset
dialog box. For instructions, see “Define an advanced recordset by writing SQL” on page 550.

For help on SQL syntax, see the SQL primer at

www.adobe.com/go/learn_dw_sqlprimer

.

5

Give the SQL variables the values of the search parameters by clicking the Plus (+) button in the Variables area

and entering the variable’s name, default value (the value the variable should take if no run-time value is returned),
and run-time value (usually a server object holding a value sent by a browser, such as a request variable).

In the following ASP example, the HTML form on the search page uses the

GET

method and contains one text field

called LastName and another called Department:

In ColdFusion, the run-time values would be

#LastName#

and

#Department#

. In JSP, the run-time values would be

request.getParameter("LastName")

and

request.getParameter("Department")

.

6

(Optional) Click Test to create an instance of the recordset using the default variable values.

The default values simulate the values that would otherwise have been returned from the search page. Click OK to
close the test recordset.

7

If you’re satisfied with the recordset, click OK.

The SQL query is inserted in your page.

The next step is to display the recordset on the results page.

Display the search results (ColdFusion, ASP, JSP, PHP)

After creating a recordset to hold the search results, you must display the information on the results page. Displaying
the records can be a simple matter of dragging individual columns from the Bindings panel to the results page. You
can add navigation links to move forward and backward through the recordset, or you can create a repeating region
to display more than one record on the page. You can also add links to a detail page.

For more information on methods of displaying dynamic content on a page other than displaying results in a
dynamic table, see “Displaying database records” on page 570.

1

Place the insertion point where you want the dynamic table to appear on the results page, and select Insert > Data

Objects > Dynamic Data > Dynamic Table.

2

Complete the Dynamic Table dialog box, selecting the recordset you defined to hold the search results.

3

Click OK. A dynamic table that displays search results is inserted on the results page.

September 4, 2007