Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 419

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Accessing and Using Data
You created a ColdFusion application page that retrieves and displays data from a database. At present, the output is
raw and needs formatting. For more information, see
Reviewing the code
The results of the query appear on the page. The following table describes the highlighted code and its function:
Code
<cfoutput query="EmpList">
#EmpList.FirstName#, #EmpList.LastName#,
#EmpList.Salary#, #EmpList.Contract#
<br>
</cfoutput>
Query output notes and considerations
When outputting query results, keep in mind the following guidelines:
• A
must retrieve data before the
cfquery
the same page, Adobe recommends that you place queries in ColdFusion components and output the results on a
separate page. For more information, see
• To output data from all the records of a query, specify the query name by using the
• Columns must exist and be retrieved to the application to output their values.
• Inside a
block that uses a
cfoutput
query; for example,
Emplist.FirstName
• As with other attributes, surround the
• As with any variables that you reference for output, surround column names with number signs (#) to tell
ColdFusion to output the current values of the column.
• Add a
tag to the end of the variable references so that ColdFusion starts a new line for each row that the query
<br>
returns.
Getting information about query results
Each time you query a database with the
they make up the query object. The following table describes the query variables, which are sometimes called query
properties:
Variable
Description
RecordCount
The total number of records returned by the query.
ColumnList
A comma-delimited list of the query columns, in alphabetical order.
The SQL statement executed.
SQL
Cached
Whether the query was cached.
Ordered array of
SQLParameters
ExecutionTime
Cumulative time required to process the query, in milliseconds.
"Introduction to Retrieving and Formatting
Description
Displays information retrieved in the EmpList query.
Displays the value of the
Contract
Inserts a line break (go to the next line) after each record.
Ends the
tag can display its results. Although you can include both on
cfoutput
"Building and Using ColdFusion
attribute, you can prefix the query variables with the name of the
cfquery
.
attribute value with double-quotation marks (").
query
tag, you get the data (the recordset) and the query variables; together
cfquery
values.
cfqueryparam
Last updated 1/20/2012
,
FirstName
LastName
fields of each record, separated by commas and spaces.
cfoutput
block.
Components" on page 177.
attribute in the
query
414
Data" on page 703.
,
, and
Salary
tag.
cfoutput

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents