Add a stored procedure (coldfusion) (cs6), Run a stored procedure (asp) (cs6) – Adobe Dreamweaver CC 2014 v.13 User Manual
Page 583
among other things, insert, update, or delete records. Stored procedures can also alter the structure of the database itself. For example, you can
use a stored procedure to add a table column or even delete a table.
A stored procedure can also call another stored procedure, as well as accept input parameters and return multiple values to the calling procedure
in the form of output parameters.
A stored procedure is reusable in the sense that you can reuse a single compiled version of the procedure to execute a database operation a
number of times. If you know a database task will be executed more than a few times—or the same task will be executed by different applications
—using a stored procedure to execute that task can make database operations more efficient.
Note: MySQL and Microsoft Access databases do not support stored procedures.
Add a stored procedure (ColdFusion) (CS6)
You can use a stored procedure to modify a database. A stored procedure is a reusable database item that performs some operation on the
database.
Before you use a stored procedure to modify a database, make sure the stored procedure contains SQL that modifies the database in some way.
To create and store one in your database, consult your database documentation and a good Transact-SQL manual.
1. In Dreamweaver, open the page that will run the stored procedure.
2. In the Bindings panel (Window > Bindings), click the Plus (+) button, and then select Stored Procedure.
3. In the Data Source pop-up menu, select a connection to the database containing the stored procedure.
4. Enter the ColdFusion Data Source user name and password.
5. Select a stored procedure from the Procedures pop-up menu.
Dreamweaver automatically fills in any parameters.
6. Select a parameter, and click Edit if you have to make changes.
The Edit Stored Procedure Variable dialog box appears. The name of the variable you are editing appears in the Name box.
Note: You must enter test values for any stored procedure input parameters.
7. Make changes as necessary:
Select a Direction from the pop-up menu. A stored procedure might have input values, output values, or both input and output values.
Select a SQL type from the pop-up menu. Enter a return variable, a run-time value, and a test value.
8. If the stored procedure takes a parameter, click the Plus (+) button to add a page parameter.
Note: You must enter corresponding page parameters for each stored procedure parameter return value. Do not add page parameters
unless there is a corresponding return value.
Click the Plus (+) button again to add another page parameter, if necessary.
9. Select a page parameter, and click the Minus (-) button to delete the parameter if necessary or click Edit to make changes to the parameter.
10. Select the Returns Recordset Named option, and then enter a name for the recordset; if the stored procedure returns a recordset, click the
Test button to see the recordset that the stored procedure returns.
Dreamweaver runs the stored procedure and displays the recordset, if any.
Note: If the stored procedure returns a recordset and takes parameters, you must enter a value in the Default Value column in the
Variables box to test the stored procedure.
You can use different test values to generate different recordsets. To change test values, click the Edit button for Parameter, and change
the test value, or click the Edit button for Page Parameter and change the default value.
11. Select the Returns Status Code Named option, enter a name for the status code, if the stored procedure returns a status code return value.
Click OK.
After you close the box, Dreamweaver inserts ColdFusion code in your page that calls a stored procedure in the database, when the code
runs on the server. The stored procedure in turn performs a database operation, such as inserting a record.
If the stored procedure takes parameters, you can create a page that gathers the parameter values and submits them to the page with the
stored procedure. For example, you may create a page that uses URL parameters or an HTML form to gather parameter values from users.
Run a stored procedure (ASP) (CS6)
With ASP pages, you must add a command object to a page to run a stored procedure. For more information on command objects, see About
ASP command objects.
1. In Dreamweaver, open the page that will run the stored procedure.
2. In the Bindings panel (Window > Bindings), click the Plus (+) button, and then select Command (Stored Procedure).
The Command dialog box appears.
576