Retrieving data

You can query databases to retrieve data at runtime. The retrieved data, called the record set, is stored on that page as a query object. A query object is a special entity that contains the record set values, plus RecordCount, CurrentRow, and ColumnList query variables. You specify the query object's name in the name attribute of the cfquery tag. The query object is often called simply the query.

The following is a simple cfquery tag:

<cfquery name = "GetSals" datasource = "CompanyInfo">
   SELECT * FROM Employee
   ORDER BY LastName
</cfquery>

Note: The terms "record set" and "query object" are often used synonymously when discussing record sets for queries. For more information, see Using Query of Queries.

When retrieving data from a database, perform the following tasks:

View comments on LiveDocs