User Guide

Table Of Contents
Using the CF.query function 831
Using the CF.query function
You use the CF.query function in your server-side ActionScript to retrieve data from a
ColdFusion MX data source. This function lets you perform queries against any ColdFusion MX
data source.
Note: The CF.query function maps closely to the cfquery CFML tag, although it currently supports a
subset of the
cfquery attributes.
Use the CF.query function to do the following:
Identify the data source you want to query.
Pass SQL statements to the data source.
Pass other optional parameters to the database.
For reference information about the
CF.query function, see CF.query in CFML Reference.
About CF.query function syntax
You can write the
CF.query ActionScript function using either named arguments or positional
arguments. The named argument style is more readable, but it requires more code. Although the
positional argument style supports a subset of
CF.query arguments, it allows a more compact
coding style that is more appropriate for simple expressions of the
CF.query function.
Using CF.query named argument syntax
The
CF.query function accepts the following named arguments:
// CF.query named argument syntax
CF.query
({
datasource:"data source name",
sql:"SQL stmts",
username:"username",
password:"password",
maxrows:number,
timeout:milliseconds
})
Note: The named argument style requires curly braces {} to surround the function arguments.
Using CF.query positional argument syntax
Positional arguments support a subset of
CF.query arguments, and you can create more efficient
code. The following is the syntax for the positional argument style:
// CF.query positional argument syntax
CF.query(datasource, sql);
CF.query(datasource, sql, maxrows);
CF.query(datasource, sql, username, password);
CF.query(datasource, sql, username, password, maxrows);
Note: When using positional arguments, do not use curly braces {}.