Retrieving Data

You can query databases to retrieve data at runtime. The retrieved data, called the result set, is stored on that page as a query object. When retrieving data from a database, perform the following tasks:

The cfquery tag

The cfquery tag is one of the most frequently used CFML tags. You use it in conjunction with the cfoutput tag so that you can retrieve and reference the data returned from a query.

When ColdFusion encounters a cfquery tag on a page, it does the following:

The cfquery tag syntax

<cfquery name="EmpList" datasource="CompanyInfo">

  You'll type SQL here

</cfquery>



In this example, the query code tells ColdFusion to:

Follow these rules when creating a cfquery tag:



Banner.Novgorod.Ru