You'll need to assign the returned query to a variables:
<cfset theQuery = yourCFC.GetAllAnnouncements()>
Then:
<cfloop query="theQuery">
...
</cfloop>
Adrian
-----Original Message-----
From: Rick Faircloth [mailto:[EMAIL PROTECTED]
Sent: 12 September 2008 16:32
To: CF-Talk
Subject: Problem with my attempt at CFC/OO usage...
Hi, all...
Well, I'm giving the CFC/OO coding another glance
and have been working through Mike Kear's great introductory tutorial,
C22 CFC Tutorial (http://afpwebworks.com).
I'm trying to re-write some of the tutorial to fit a test scenario.
To keep this short and to the point: If I have this method:
<cffunction name = "GetAllAnnouncements"
access = "public"
output = "false"
returntype = "query"
hint = "Returns a query of all announcements in the
database">
<cfset var Q_GetAllAnnouncements = 0 />
<cfquery name = "Q_GetAllAnnouncements" datasource = "#variables.dsn#">
select *
from announcements
order by title
</cfquery>
<cfreturn Q_GetAllAnnouncements />
</cffunction>
How do I reference the data returned to the calling page?
It would seem to make sense that the value following "cfreturn"
would be what should be referenced..."Q_GetAllAnnouncements", but
that doesn't work...
I tried:
- <cfloop query="Q_GetAllAnnouncements">
- <cfloop query="announcements_DAO.GetAllAnnouncements">
- <cfloop query="announcements_DAO.GetAllAnnouncements()">
I can do a cfdump with:
var = "#announcements_DAO.GetAllAnnouncements()#"
Help! Lost in the sauce...
Rick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312441
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4