QueryAddRow

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

See also QueryAddColumn and QuerySetCell.

Syntax

QueryAddRow(query [, number ])
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="GetEmp" DATASOURCE="HRApp">
SELECT * 
FROM Departments
</CFQUERY>

<P>The query object "GetEmp" has <CFOUTPUT>#GetEmp.RecordCount#
</CFOUTPUT> rows.<BR>

<CFSET CountRecs=#GetEmp.RecordCount# +1>

<!--- Add a row. --->
<CFSET Temp=QueryAddRow(GetEmp)>
<!--- Set the values of the cells in the roll. --->
<CFSET Temp=QuerySetCell(GetEmp, "Department_ID", CountRecs)>
<CFSET Temp=QuerySetCell(GetEmp, "Department_Name", "Engineering")>
<CFSET Temp=QuerySetCell(GetEmp, "Location", "Cambridge")>

<CFOUTPUT QUERY="GetEmp">
    #Department_ID#. #Department_Name#, #Location#<BR>
</CFOUTPUT>
</BODY>
</HTML>