Use the CFQUERY tag to define a query on an application page. When ColdFusion encounters a CFQUERY tag on a page, it does the following:
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.
Refer to the CFML Language Reference for ColdFusion Express for full CFQUERY syntax.
In this example, the query code tells ColdFusion to:
HRAppdata source to connect to the HRExpress.mdb database.
<CFQUERY NAME="EmpList" DATASOURCE="HRApp"> You'll type SQL here </CFQUERY>
|Note:||The data source must exist in order to perform a successful query and that's why all examples reference HRApp; a data source delivered with the product.|