Each time you query a database with the cfquery tag, you get not only the data itself, but also query properties, as described in the following table:
emplist.cfm in ColdFusion Studio.
<html> <head> <title>Employee List</title> </head> <body> <h1>Employee List</h1> <cfquery name="EmpList" datasource="CompanyInfo"> SELECT FirstName, LastName, Salary, Contract FROM Employee </cfquery> <cfoutput query="EmpList"> #FirstName#, #LastName#, #Salary#, #Contract#<br> </cfoutput> <br> <cfoutput> The query returned #EmpList.RecordCount# records. </cfoutput> </body> </html>
emplist.cfm.The number of employees now appears below the list of employees.
|
Note The variable |
You now display the number of records retrieved in the query. The following table describes the code and its function:
When using query properties, keep the following guidelines in mind:
cfoutput block so that ColdFusion outputs the query property value to the page.
cfoutput tag query attribute when you output the RecordCount or ColumnList property. If you do, you will get one copy of the output for each row. Instead, prefix the property with the name of the query.LiveDocs comments are not longer enabled for ColdFusion 5.0. Please use one of the following resources instead.
ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 5.0