Verify that the
4
previous exercise:
Open the tripsearch.cfm page in the my_app directory in your browser.
a
In the Departure Date drop-down list box, select Before, enter 1/1/1900 as the date (specify
b
1900-1-1 on UNIX), and select Smaller Than 0 for the price.
Click the Search button.
c
Because the departure date is considered in the query, there are no rows returned.
Note: If you planned to use many more fields as search criteria, the approach used to add
departure date and price criteria to the Trip Search form is not the most elegant solution. A generic
routine to handle WHERE clause string construction based on specific data types could reduce
the code and be a more extensible solution then the one presented here. This more extensible
approach is beyond the scope of this tutorial, however.
Summary
This lesson described how to access a relational database using ColdFusion. You used the SQL
SELECT statement and the
tool that dynamically builds a WHERE clause of the SQL SELECT statement using
tags. To ensure that the SQL statement remains intact, you used the
cfset
PreserveSingleQuotes
In the next lesson
In the next lesson, you will build the main navigation page for the Trip Maintenance application.
This page will display detail information about the currently selected trip. Additionally, it will
provide buttons to do trip maintenance and browsing through the trips table. You will also link
the trip search facility that you built in this lesson to the main page that you will build in the next.
and
price
departureDate
and
cfquery
CFML function.
are now considered in the query, as in step 4 in the
tags to display trip lists. You built a search
cfoutput
and
cfif
Summary
75
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