To select and output data from a database, you create a ColdFusion application page that includes both CFML and HTML. The application page contains sections for selecting the data and for outputting the results of the selection.
This section introduces ColdFusion data source queries using the Structured Query Language (SQL) in a CFQUERY tag.
The first step is to define a query to select data from a database. ColdFusion uses the CFQUERY tag to define queries. The full syntax for the CFQUERY tag is:
<CFQUERY NAME="query_name"
DATASOURCE="ds_name"
USERNAME="username"
PASSWORD="password"
MAXROWS="number"
TIMEOUT="milliseconds"
BLOCKFACTOR="1" (default)
DBPOOL="database connection pool name"
DEBUG="yes/no">
SQL statements
</CFQUERY>
|