All cleared up... thanks, Charlie.

Rick

Charlie Griefer wrote:
> the return variable has to match whatever it is you want to return.  in
> *this* case, it's the query.
> let's say you just wanted to return a recordcount... then the return
> variable wouldn't match the query name.  it'd match a variable name:
>
> <cffunction name="getNumberOfUsers" output="false" returntype="numeric">
>
>      <cfset var myQuery = "" />
>      <cfset var howMany = "" />
>
>      <cfquery name="myQuery" datasource="#application.dsn#">
>           SELECT * FROM foo WHERE bar = 1
>      </cfquery>
>
>      <cfset howMany = myQuery.recordcount />
>
>      <cfreturn myQuery.recordcount />
> </cffunction>
>
> for what it's worth, the function above doesn't need the 'howMany' variable.
>  you can simply <cfreturn myQuery.recordcount />.  just trying to illustrate
> the use of variable names for you.
>
> also (and this might have been said already), in the interest of keeping the
> CFC black-boxed... the datasource name should be passed in (as opposed to
> referencing the application scope from within the CFC).
>
>   

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314250
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to