Query Notes And Considerations - MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual

Table of Contents

Advertisement

Building Queries
Reviewing the code
The query you just created retrieves data from the CompanyInfo database. The
following table describes the code and its function:
Code
<cfquery name="EmpList"
datasource="CompanyInfo">
SELECT FirstName, LastName,
Salary, Contract
FROM Employee
</cfquery>

Query notes and considerations

When creating queries to retrieve data, keep the following guidelines in mind:
Enter the query
name
Surround attribute settings with double quotes(").
Make sure that a data source exists in the ColdFusion Administrator before you
reference it n a
cfquery
attributes to dynamically specify a database.
queryString
The SQL that you write is sent to the database and performs the actual data
retrieval.
Columns and tables that you refer to in your SQL statement must exist, otherwise
the query will fail.
Reference the query data by naming the query in one of the presentation tags,
such as
,
cfoutput
cfgrid
Description
Queries the database specified in the
CompanyInfo data source
Gets information from the FirstName,
LastName, Salary, and Contract fields in
the Employee table
Ends the
cfquery
and
attributes in the begin
datasource
tag. Alternatively, use the
,
,
cftable
cfgraph
block
cfquery
dbtype = "dynamic"
, or
later on the page.
cftree
29
tag.
and

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 5

Table of Contents