System information
129
CHAPTER 12
Lesson 9: Enabling Database Maintenance
In this lesson, you will enable maintenance of the trips database. The exercises will guide you
through the steps of adding the database update logic to delete trips, add new trip offerings, and
update existing trips in the Compass Travel database.
This lesson contains the following exercises:
Exercise 1: Deleting the current trip record shown on the Trip Detail page . . . . . . . . . . . . . . 129
Exercise 2: Adding trips with SQL INSERT statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Exercise 3: Adding data using the cfinsert tag. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Exercise 4: Updating a SQL row using the cfupdate tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Exercise 5: Linking the Trip Edit page to the main page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Exercise 6: Inserting values in the edit form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
ColdFusion tags introduced in this lesson
The following table identifies the ColdFusion tags that you use in this lesson to enhance the
ColdFusion application:
Exercise 1: Deleting the current trip record shown on the Trip
Detail page
In “Lesson 8: Implementing Browsing and Searching” on page 123, you created the
tripeditaction.cfm page to contain server side edits for the trip edit data entry form. In this lesson,
you complete the tripeditaction.cfm 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.
Element Type Description
cfinsert
Tag Inserts records in a JDBC data source.
cfupdate
Tag Updates records in a JDBC data source.