An empty query with a set of columns, or an empty query.
QueryNew(columnlist)
QueryAddColumn, QueryAddRow, QuerySetCell
| Parameter | Description |
|---|---|
| columnlist |
A string or a variable that contains one. Delimited list of columns, or an empty string. |
If you specify an empty string, you can add a column to the query and populate its rows with the contents of a one-dimensional array using QueryAddColumn.
<h3>QueryNew Example</h3>
<p>We will construct a new query with two rows:
<cfset myQuery = QueryNew("name, address, phone")>
<!--- make some rows in the query --->
<cfset newRow = QueryAddRow(MyQuery, 2)>
<!--- set the cells in the query --->
<cfset temp = QuerySetCell(myQuery, "name", "Fred", 1)>
<cfset temp = QuerySetCell(myQuery, "address", "9 Any Lane", 1)>
<cfset temp = QuerySetCell(myQuery, "phone", "555-1212", 1)>
<cfset temp = QuerySetCell(myQuery, "name", "Jane", 2)>
<cfset temp = QuerySetCell(myQuery, "address", "14 My Street", 2)>
<cfset temp = QuerySetCell(myQuery, "phone", "555-1444", 2)>
<!--- output the query --->
<cfoutput query = "myQuery">
<pre>#name# #address# #phone#</pre>
</cfoutput>
To get any element in the query, we can output it individually
<cfoutput>
<p>#MyQuery.name[2]#'s phone number: #MyQuery.phone[2]#
</cfoutput>
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6
Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt256.htm
Comments
fusebox_steve said on Jul 1, 2002 at 10:29 PM : TheoPeters said on Aug 29, 2003 at 10:17 AM : TheCoolLion said on Sep 27, 2005 at 3:52 PM :