• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Deleting a Database Record

Creating an interface for deleting a record is actually a lot less work than either adding or editing one. Since the important thing about deleting a record is making sure that you’re deleting the correct record, we’ll use the detail page we created at the beginning of the chapter, in Master Detail Page Sets, to show the record, and then simply add a button to delete the record that gets shown on the detail page.

To add a button to delete a record:

1.
Open the detail page you created in the first section of this chapter.

2.
From the menu bar, select Insert > Form to insert a blank form with its gaily dashed red line.

3.
From the menu bar, select Insert > Form Objects > Button to insert the button that will request the deletion.

4.
Select the form by clicking on that dashed line, and in the Property inspector’s Form Name text box, change the form’s name to delete.

5.
Select the button, and in the Property inspector, change its label to “Delete Record.”

6.
In the Server Behaviors panel, click the + (plus) button and select Delete Record from the menu that appears.

The Delete Record dialog box will appear (Figure 8.30).

Figure 8.30. The Delete Record dialog box is much simpler than the others.


7.
Choose the connection to your database, and choose the appropriate data table. The recordset should be selected by default (Figure 8.31).

Figure 8.31. Make sure you’re deleting the correct record!


8.
In the Unique Key Column, select the key field for your table.

9.
The Delete By Submitting menu should already be set to delete (the form we created and renamed in Steps 3 and 4).

10.
In the After Deleting Go To text box, type the name of the file you want to appear after the deletion is submitted.

11.
Save the file and upload it to your server.

12.
Open the Master page you created at the beginning of this chapter in your browser (not the duplicate you created in the most recent section) and click on a record.

The detail page will appear, complete with a delete record button (Figure 8.32).

Figure 8.32. Now you can punch holes in your database to your heart’s content.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint