Writing SQL and CFML statements to interact with a data source
After ColdFusion makes a connection to the data source, you can interact with that database by
using SQL and ColdFusion.
To interact with an established data source, you must include SQL statements in your CFML
statements; for example:
<cfquery name="queryname" datasource="namedbfile">
SELECT FirstName, LastName, DepartmentID
From Employee
</cfquery>
In this example, the first attribute of the
attribute of the
cfquery
the fields (columns) to be retrieved from a table named Employee.
CFML tags that interact with a database
The following table lists the CFML tags that you can use to interact with a database:
Tag
cfquery
cfinsert
cfupdate
Part II of this manual introduces these tags when you use them to interact with the sample
database. For more information about interacting with a database, see ColdFusion MX Developer's
Guide or CFML Reference.
cfquery
tag defines the name of the data source. The
Description
To retrieve (query) information in a database.
To add records to a database.
To update information in a database.
tag is the name of the query. The second
SELECT
Using SQL with ColdFusion
statement defines
37
Need help?
Do you have a question about the COLFUSION MX 7-GETTING STARTED BUILDING COLDFUSION MX and is the answer not in the manual?
Questions and answers