QueryAddRow

Description

Adds a specified number of empty rows to a query. Returns the total number of rows in the query that you are adding rows to.

Category

Query functions

Syntax


QueryAddRow(query [, number ]) 

See also

QueryAddColumn, QueryAddRow, QuerySetCell, QueryNew

Parameters

Parameter
Description
query
Name of the query already executed.
number
Number of rows to add to the query. Default is 1.

Example

<!--- This example shows the use of QueryAddRow and QuerySetCell --->

<html>

<head>

<title>

QueryAddRow Example

</title>

</head>



<body>

<H3>QueryAddRow Example</H3>



<!--- start by making a query --->

<cfquery name = "GetCourses" datasource = "cfsnippets">

SELECT Course_ID, Course_Num, 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, "Course_ID", CountVar)>

 <cfset CountVar = CountVar + 1>

 <cfset Temp = QuerySetCell(GetCourses, "Course_Num", 100*CountVar)>

 <cfset CountVar = CountVar + 1>

 <cfset Temp = QuerySetCell(GetCourses, "Descript", 

 "Description of variable #Countvar#")>

</CFLOOP>

...







Banner.Novgorod.Ru