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

You can use UltraDev to create a command object that inserts, updates, or deletes records in a database.

To create a command object that lets your page edit a database record:

1 Open the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button, and choose Command.
The Command dialog box appears.
2 Enter a name for the command, choose a connection to the database containing the records you want to edit, and choose the editing operation you want the command to perform—Insert, Update, or Delete from the Type pop-up menu.
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.

4 Click OK to create the command.
After you close the dialog box, UltraDev inserts ASP code in your page that, when run on the server, creates a command that inserts, updates, or deletes records in the database.

By default, the code sets the Prepared property of the Command object to True, which makes the application server reuse a single compiled version of the object every time the command is run. To change this setting, switch to Code view and change the Prepared property to False.

In the above example, you would probably create a page with an HTML form next 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 command.

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