beautypg.com

Adobe Dreamweaver CC 2015 User Manual

Page 607

background image

600

Dynamic sites, pages and web forms

Last updated 6/3/2015

dbvarname="@@paramName@@"

value="@@value@@"

cfsqltype="@@type@@">

<@ endloop @>

Note: New lines after each “@>” are ignored.

If the user entered the following parameter values in the Server Behavior Builder dialog box:

procedure = "proc1"

conn = "connection1"

paramName = ["@CategoryId", "@Year", "@ISBN"]

value = ["#Form.CategoryId#", "#Form.Year#", "#Form.ISBN#"]

type = ["CF_SQL_INTEGER", "CF_SQL_INTEGER", "CF_SQL_VARCHAR"]

The server behavior would insert the following run-time code in the page:

datasource=#MM_connection1_DSN#

username=#MM_connection1_USERNAME#

password=#MM_connection1_PASSWORD#>

cfsqltype="CF_SQL_INTEGER">

cfsqltype="CF_SQL_INTEGER">

cfsqltype="CF_SQL_VARCHAR">

Note: Parameter arrays cannot be used outside of a loop except as part of a conditional directive expression.

Using the loop directive’s _length and _index variables

cfsqltype="CF_SQL_INTEGER">
cfsqltype="CF_SQL_VARCHAR">

In this example, the CFSTOREDPROC tag can include zero or more CFPROCPARAM tags. However, without
support for the loop directive, there is no way to include the CFPROCPARAM tags within the inserted
CFSTOREDPROC tag. If this were to be created as a server behavior without the use of the loop directive, you
would need to divide this example into two participants: a main CFSTOREDPROC tag, and a CFPROCPARAM tag
whose participant type is multiple.

Using the loop directive, you can write the same procedure as follows:

datasource=#MM_@@conn@@_DSN#

username=#MM_@@conn@@_USERNAME#

password=#MM_@@conn@@_PASSWORD#>

<@ loop (@@paramName@@,@@value@@,@@type@@) @>

datasource=#MM_connection_DSN#
username=#MM_connection_USERNAME#
password=#MM_connection_PASSWORD#>