How to set a cell to a value in a query object in ColdFusion

QuerySetCell() - set a cell to a value in a query object

QuerySetCell.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>QuerySetCell function example: how to set a cell to a value in a query object</title>
</head>

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

<cfset qColor=QueryNew("ColorID, ColorName, ColorValue","Integer, VarChar, VarChar")>

<cfset Temp=QueryAddRow(qColor,2)>

<cfset Temp=QuerySetCell(qColor,"ColorID",1,1)>
<cfset Temp=QuerySetCell(qColor,"ColorName","Beige",1)>
<cfset Temp=QuerySetCell(qColor,"ColorValue","##F5F5DC",1)>

<cfset Temp=QuerySetCell(qColor,"ColorID",2,2)>
<cfset Temp=QuerySetCell(qColor,"ColorName","Bisque",2)>
<cfset Temp=QuerySetCell(qColor,"ColorValue","##FFE4C4",2)>


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






More ColdFusion examples