Deleting Records

Dreamweaver’s Delete Record server behavior lets you build pages for removing records from a database. The setup is similar to using the Update Record server behavior, in that you must create a page with a recordset that retrieves a single record—the item to delete. This is just like a detail page, as described on page 663. Another page must link to the delete page and provide the proper key for filtering to a single record on the delete page.

One way to go about this is to add a link—Delete This Record, perhaps—on a record detail page. The link should pass the primary key for the condemned record to another page (the Go to Detail Page server behavior described on page 667 can help with this). This page—the Delete page—would include a recordset that retrieves the file to be deleted.

To confirm the deletion, the page might say something like, “Are you sure you want to delete this record?” (Adding some dynamic text from the recordset, such as a name column, will help identify the record.)

Note

ASP.NET Note

The Delete server behavior for ASP.NET works differently. For an example of creating a delete function in ASP.NET, see the tutorial on page 708.

What makes a delete page differ from a regular detail page is that it also includes a form with a single Submit button and a Delete Record Server behavior.

To create a delete page, proceed as follows:

  1. Create a dynamic page containing a filtered recordset.

    As noted above, the recordset should retrieve a single record—the one ...

Get Dreamweaver MX: The Missing Manual now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.