Setting the advanced Recordset dialog box

Setting the advanced Recordset dialog box

This dialog box defines a recordset as a source of dynamic content by writing a custom SQL statement, or by creating a SQL statement using the graphical Database Items tree.

To complete the dialog box:

  1. In the Name text box, enter a name for the recordset.

    A common practice is to add the prefix rs to recordset names to distinguish them from other object names in the code. For example: rsPressRelease

    Note that recordset names can only contain letters, numbers, and the underscore character (_). You cannot use special characters or spaces.

  2. Select a connection from the Connection pop-up menu.
  3. Enter a SQL statement in the SQL text area or use the graphical Database Items tree at the bottom of the dialog box to build a SQL statement from the chosen recordset.

    For more information writing SQL statements, see SQL Primer, and Creating SQL queries using the Database Items tree.

    If you want to use the Database Items tree to build the SQL statement:

    • Ensure the SQL text area is blank.
    • Expand the branches of the tree until you find the database object you need--a column in a table, for example, or a stored procedure in the database.
    • Select the database object and click one of the buttons on the right side of the tree.

    For example, if you select a table column, the available buttons are SELECT, WHERE, and ORDER BY. Click one of the buttons to add the associated clause to your SQL statement.

    You can also use a predefined SQL statement in a stored procedure by selecting the stored procedure from the Database Items tree and clicking the Procedure button. Dreamweaver automatically fills in the SQL and Variable areas.

  4. If the SQL statement contains variables, define their values in the Variables area by clicking the Plus (+) button and entering the variable’s name, default value (the value the variable should take if no runtime value is returned), and runtime value.

    If the SQL statement contains variables, make sure the Default Value column of the Variables box contains valid test values.

    The runtime value is usually a URL or form parameter entered by a user in an HTML form field. For more information on URL and form parameters, see Obtaining Data for Your Page.

    URL parameters in the Runtime Value column.

    Server Model

    Runtime value expression for URL parameter

    ASP

    Request.QueryString("formFieldName")

    JSP

    request.getParameter("formFieldName")

    PHP

    #formFieldName#

    Form parameters in the Runtime Value column:

    Server Model

    Runtime value expression for form parameter

    ASP

    Request.Form("formFieldName")

    JSP

    request.getParameter("formFieldName")

    PHP

    #formFieldName#

  5. Click Test to connect to the database and create an instance of the recordset.

    If the SQL statement contains variables, make sure the Default Value column of the Variables box contains valid test values before clicking Test.

    If successful, a table appears displaying the data in your recordset. Each row contains a record and each column represents a field in that record. Click OK to clear the recordset.

  6. If satisfied with your work, click OK.

Related topics

  • Database Connections for ASP Developers
  • Database Connections for JSP Developers
  • Database Connections for PHP Developers
  • Creating an advanced recordset by writing SQL
  • Creating SQL queries using the Database Items tree
  • Beginner’s Guide to Databases
  • SQL Primer


Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Defining Sources of Dynamic Content
Developing Applications Rapidly