Adobe COLDFUSION 9 Manual page 504

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Accessing and Using Data
<html>
<head>
<title>Adding Query Data to an Index</title>
</head>
<body>
<!--- Retrieve data from the table. --->
<cfquery name="getEmps" datasource="cfdocexamples">
SELECT * FROM EMPLOYEE
</cfquery>
<!--- Update the collection with the above query results. --->
<cfindex
query="getEmps"
collection="CodeColl"
action="Update"
type="Custom"
key="Emp_ID"
title="Emp_ID"
body="Emp_ID,FirstName,LastName,Salary">
<h2>Indexing Complete</h2>
<!--- Output the record set. --->
<p>Your collection now includes the following items:</p>
<cfoutput query="getEmps">
<p>#Emp_ID# #FirstName# #LastName# #Salary#</p>
</cfoutput>
</body>
</html>
3
Save the file as collection_db_index.cfm in the myapps directory under the web root directory.
Open the file in the web browser to index the collection.
4
The resulting recordset appears.
Search and display the query results
Create a ColdFusion page with the following content:
1
Last updated 8/5/2010
499

Advertisement

Table of Contents
loading

Table of Contents