In this exercise, you will modify the Trip Search Results page to add the criteria needed for the departure and price query.
cfquery code block.
departureDate WHERE subclause, enter or copy and paste the code in the following table immediately before the cfquery code block:
| For this database | Enter this code |
|---|---|
|
(Windows users) Microsoft Access database file |
<!--- Build subclause for departureDate ---> <cfif Form.departureValue GT ""> <cfif Form.departureOperator EQ "EQUALS"> <cfset WhereClause = WhereClause & " and departureDate = " & CreateODBCDate(Form.departureValue)> <cfelseif Form.departureOperator EQ "AFTER"> <cfset WhereClause = WhereClause & " and departureDate > " & CreateODBCDate(Form.departureValue)> <cfelseif Form.departureOperator EQ "BEFORE"> <cfset WhereClause = WhereClause & " and departureDate < " & CreateODBCDate(Form.departureValue)> </cfif> </cfif> |
|
(UNIX users) PointBase database file |
<!--- Build subclause for departureDate ---> <cfif Form.departureValue GT ""> <cfif Form.departureOperator EQ "EQUALS"> <cfset WhereClause = WhereClause & " and departureDate = Date '" & Form.departureValue & "'"> <cfelseif Form.departureOperator EQ "AFTER"> <cfset WhereClause = WhereClause & " and departureDate > Date '" & Form.departureValue & "'"> <cfelseif Form.departureOperator EQ "BEFORE"> <cfset WhereClause = WhereClause & " and departureDate < Date '" & Form.departureValue & "'"> </cfif> </cfif> |
price WHERE subclause, enter the following code after the code you entered in the previous step.
<!--- Build subclause for price---> <cfif Form.priceValue GT ""> <cfif Form.priceOperator EQ "EQUALS"> <cfset WhereClause = WhereClause & " and price = " & form.priceValue> <cfelseif Form.priceOperator EQ "GREATER"> <cfset WhereClause = WhereClause & " and price > " & form.priceValue> <cfelseif Form.priceOperator EQ "SMALLER"> <cfset WhereClause = WhereClause & " and price < " & form.priceValue> </cfif> </cfif>
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting
Version 7
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/7/htmldocs/00000136.htm