Macromedia colfusion mx 7-getting started building coldfusion mx applications Manuel D’Utilisation

Page de 152
Exercise 5: Creating additional queries
67
output="false">
<cfquery name="budgetTrips" datasource="CompassTravel">
SELECT tripName, departureDate, returnDate, price
FROM trips 
WHERE price <= 1500
ORDER BY tripName
</cfquery>
<cfreturn budgetTrips>
</cffunction>
3.
Save the file.
Let Dreamweaver do it
You can use the Dreamweaver Extensions to create a CFC query and invoke the method that 
contains the query from the triplisting.cfm page.
To create the enhanced CFC query in Dreamweaver:
1.
Open the gettrips.cfc file and position the pointer before the closing 
cfcomponent
 tag.
2.
Click the Bindings tab.
3.
Click the + button.
4.
Select Recordset (Query).
5.
In the Name text box, enter budgetTrips.
6.
Click the New Function button.
7.
In the New function name text box, enter getBudgetTrips.
8.
Click OK.
9.
In the Data Source list, select CompassTravel.
10.
In the Table list, select trips.
11.
Click the Selected button.
12.
Select tripName, departureDate, returnDate, and price from the list of columns.
13.
In the Filter section, select price, select < from the list of operators, select Entered value, and 
enter 1500 in the text box.
14.
In the Sort section, select tripName, and select Ascending.
15.
Click OK.
16.
Save the file.