Chapter 2: ColdFusion Functions
QuerySetCell
Sets the cell in a specified column to a specified value. If no row number is specified,
the cell on the last row will be set. Returns TRUE.
See also
Syntax
QuerySetCell( query , column_name , value [, row_number ])
query
Name of the query already executed.
column_name
Name of the column in the query.
value
Value to set in the specified cell.
row_number
Number of the row. Defaults to last row.
Example
<!--- This example shows the use of QueryAddRow and QuerySetCell --->
<HTML>
<HEAD>
<TITLE>
QuerySetCell Example
</TITLE>
</HEAD>
<BODY>
<H3>QuerySetCell Example</H3>
<!--- start by making a query --->
<CFQUERY NAME="GetCourses" DATASOURCE="cfsnippets">
SELECT
FROM
Courses
</CFQUERY>
<P>The Query "GetCourses" has <CFOUTPUT>#GetCourses.RecordCount#
</CFOUTPUT> rows.
<CFSET CountVar = 0>
<CFLOOP CONDITION="CountVar LT 15">
<CFSET temp = QueryAddRow(GetCourses)>
<CFSET CountVar = CountVar + 1>
<CFSET Temp = QuerySetCell(GetCourses, "Course_ID", CountVar)>
<CFSET CountVar = CountVar + 1>
<CFSET Temp = QuerySetCell(GetCourses, "Number", 100*CountVar)>
<CFSET CountVar = CountVar + 1>
<CFSET Temp = QuerySetCell(GetCourses, "Descript",
QueryAddColumn
and QueryAddRow.
Course_ID, Number, Descript
485
Need help?
Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?