> Is query a structure  in CF 4.01?

No, queries are not structures in any version of CF. They're fundamentally
different - a query is essentially an array of structures.

> How can I convert a query to a structure in CF 4.01?

If you only have two fields within your query, you can loop over that query
and append the values of the fields as key-value pairs within your
structure:

<cfquery name="myquery" datasource="myds">
        SELECT ID, Name
        FROM   MyTable
</cfquery>

<cfset MyStruct = StructNew()>

<cfoutput query="myquery">
        <cfset MyStruct[myquery.ID] = myquery.Name>
</cfoutput>

Although, to be perfectly honest, there's little reason to do this -
queries, like structures, are complex data objects which can be stored in
memory and manipulated as needed.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to