Accessibility
 
Home > Products > UltraDev > Support > Editing Database Records
Dreamweaver UltraDev Icon Macromedia Dreamweaver UltraDev Support Center - Editing Database Records
Creating a prepared statement that edits a database record

To create a prepared statement that inserts, updates, or deletes records in a database, use the Prepared (Insert, Update, Delete) server behavior.

1 Open the Server Behavior panel (Window > Server Behaviors), click the Plus (+) button, and choose Prepared (Insert, Update, Delete).
The following dialog box appears:

2 Enter a name for the prepared statement, choose a connection to the database containing the records you want to edit, and choose the editing operation you want the prepared statement to perform—Insert, Update, or Delete.
UltraDev starts the SQL statement for you based on the type of operation you choose. For example, here's the dialog box after choosing Insert:

3 Complete the SQL statement.
Use the Variables area to define any SQL variables. For example, below is an Insert statement that contains three SQL variables. The values of these variables are provided by URL parameters passed to the page, as defined in the Run-time Value column of the Variables area

.

After you close the dialog box, UltraDev inserts JSP code in your page that, when run on the server, creates a prepared statement that inserts, updates, or deletes records in the database.

In the above example, next you would probably create a page with an HTML form so users could enter record data. The HTML form would contain three text fields (txtFirstName, txtLastName, and txtDept) and a submit button. As well, the form would use the GET method and submit the text field values to the page containing your prepared statement.

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