Deleting the current trip record shown on the Trip Detail page
Before you can write the code to delete a trip, you must understand the underlying SQL
statement to delete rows from the trips table.
SQL DELETE Statement
The SQL DELETE statement removes existing rows in a relational table. The format of the
DELETE statement is as follows:
DELETE FROM table_name WHERE column_name = some_value
Consider a database table named Clients, with the following rows, that holds information about
people:
LastName
Jones
Adamson
Green
To delete everyone from New York from the table, use the following statement:
DELETE FROM Clients WHERE City = 'New York'
After the database management system processed the preceding statement, the table would
contain the following row only:
LastName
Adamson
To ensure that the Trip Maintenance application deletes only the proper trip, you must use the
unique tripID key when issuing the SQL DELETE. The RecordID field holds the tripID.
Therefore, using the hidden
statement deletes a row from the Trips table reads:
DELETE FROM trips WHERE tripID = #Form.RecordID#
Exercise: handle search and delete in maintenance action page
In this exercise, you will link the search function developed in
ColdFusion Application
delete function. Then you will test this functionality by deleting a trip, then searching for it to
ensure it was deleted successfully.
Follow these steps to create the maintenance action page that implements the search and delete
functionality.
To create the maintenance action page:
In your editor, create a CFM page.
1
Delete any default lines of code if your editor automatically adds them.
2
FirstName
Tom
Anita
Peter
FirstName
Anita
input tag from the Trip Detail page, the following SQL
RecordID
to the main page. Further, you will provide code to support the trip
Address
50 Main St
521 Beacon St
1 Broadway
Address
521 Beacon St
Lesson 2: Writing Your First
Enhancing the Trip Maintenance application
City
New York
Boston
New York
City
Boston
115
Need help?
Do you have a question about the COLDFUSION MX 61-GETTING STARTED BUILDING COLDFUSION MX and is the answer not in the manual?
Questions and answers