I'm selecting a single record from SQL Server and want to pass the results
as a structured variable, rather than a query variable.  How do I obtain the
list of fields in the query so that I can loop through them?

I know how to loop through a collection of fields in a structured variable
and I know how to loop through a list of fields that I define, but I don't
know how to obtain the list of fields in a query.  Any tips would be great.
Below are the examples I do know.

Looping through query based on explicit list of fields

<CFSET FieldList = "FirstName,LastName,UserName,PrimaryEmail">
<cfloop collection="#qUserDetails#" item="thisField">
 <CFSET "UserDetails.#thisField#" = Evaluate("qUserDetails.#thisField#")>
</cfloop>

Looping through collection:  works for valid struct or COM object, but not
for query object

<CFOutput>
<cfloop collection="#UserRole#" item="var">
    UserRole.#var# = #UserRole[var]#<br>
</cfloop>
</CFOutput>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Reply via email to