How to add a specified number of empty rows to a query in ColdFusion

QueryAddRow() - add a specified number of empty rows to a query

QueryAddRow.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>QueryAddRow function example: how to add a specified number of empty rows to a query</title>
</head>

<body>
<h2 style="color:HotPink">QueryAddRow Function Example</h2>

<cfset qColor=QueryNew("ColorID, Name, Value","Integer, VarChar, VarChar")>

<cfset Temp=QueryAddRow(qColor,3)>

<cfset Temp=QuerySetCell(qColor,"ColorID",1,1)>
<cfset Temp=QuerySetCell(qColor,"Name","Aqua",1)>
<cfset Temp=QuerySetCell(qColor,"Value","##00FFFF",1)>

<cfset Temp=QuerySetCell(qColor,"ColorID",2,2)>
<cfset Temp=QuerySetCell(qColor,"Name","Aquamarine",2)>
<cfset Temp=QuerySetCell(qColor,"Value","##7FFFD4",2)>

<cfset Temp=QuerySetCell(qColor,"ColorID",3,3)>
<cfset Temp=QuerySetCell(qColor,"Name","Azure",3)>
<cfset Temp=QuerySetCell(qColor,"Value","##F0FFFF",3)>


<cfdump var="#qColor#" label="qColor">
</body>
</html>





More ColdFusion examples