User Guide

CF.query 1103
You can manipulate the record set returned by the CF.query function using methods in the
RecordSet ActionScript class. The following are some of the methods available in the RecordSet
class:
RecordSet.getColumnnames
RecordSet.getLength
RecordSet.getItemAt
RecordSet.getItemID
RecordSet.sortItemsBy
RecordSet.getNumberAvailable
RecordSet.filter
RecordSet.sort
For more information on using server-side ActionScript, see Chapter 34, “Using Server-Side
ActionScript” in ColdFusion MX Developer’s Guide. For more detailed information about the
RecordSet ActionScript class, see Using Flash Remoting.
Example
// Define a function to do a basic query
// Note use of positional arguments
function basicQuery()
{
result = CF.query("myquery", "cust_data", "SELECT * from tblParks");
return result;
}
// Example function declaration using named arguments
function basicQuery()
{
result = CF.query({datasource:"cust_data", sql:"SELECT * from tblParks"});
return result;
}
// Example of the CF.query function using maxrows argument
function basicQueryWithMaxRows()
{
result = CF.query("cust_data", "SELECT * from tblParks", 25);
return result;
}
// Example of the CF.query function with username and password
function basicQueryWithUser()
{
result = CF.query("cust_data", "SELECT * from tblParks",
"wsburroughs", "migraine1");
return result;
}