ColdFusion 9.0 Resources |
QueryAddRowSee alsoQueryAddColumn, QuerySetCell, QueryNew; Creating a recordset with the QueryNew() function in the Developing ColdFusion Applications Parameters
Example<h3>QueryAddRow Example</h3> <!--- start by making a query ---> <cfquery name = "GetCourses" datasource = "cfdocexamples"> SELECT Course_ID, Number, Descript 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, "Number", 100*CountVar)> <cfset Temp = QuerySetCell(GetCourses, "Descript", "Description of variable #Countvar#")> </cfloop> <P>After the QueryAddRow action, the query has <CFOUTPUT>#GetCourses.RecordCount#</CFOUTPUT> records. <CFOUTPUT query="GetCourses"> <PRE>#Course_ID# #Number# #Descript#</pre> </cfoutput> |