Thanks for the info, Matt.

I think I've got a handle on those methods.

One thing I still haven't been able to get to work
is setting up an "init" function for my db in a cfc.

Can you explain how that work and show me an example
of the code I need to put in a cfc.

I tried this that someone gave me:

<cffunction name="init">
        <cfargument name="dsn">
        <cfset variables.dsn = arguments.dsn />
        <cfreturn this>
</cffunction>

But that doesn't make sense to me.  My dsn is set
in application.cfm like so:  cfset application.dsn = "myDB".
So why, "variables.dsn" above?

I just don't understand what the code is doing.
Why is variables.dsn being set to be the value of
arguments.dsn?  And what exactly does "cfreturn this" do?

I'm just lacking in my understanding, I think, of what the CFC
is providing for the calling page with this type of code.

Perhaps it's time to get the CF8 version of CFWACK.
(Last one I got was for CF4.5... :o)

Rick

> -----Original Message-----
> From: Matt Williams [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 20, 2008 10:33 AM
> To: CF-Talk
> Subject: Re: Waaahhhh! Why won't my CFC work!
> 
> >> On Friday 20 Jun 2008, Rick Faircloth wrote:
> >> > What would be the best way to pass variables to a CFC
> >> > for processing?
> 
> To go back to this question, there are several methods for passing in
> variables. There is no really best way, it is more a matter of
> personal preference. Besides the use of cfinvoke, here are some ways
> to do it with <cfset>.
> 
> 1) Named arguments. Here you actually specify the argument names when
> you call a method
> <cfset myQuery = someObject.getMyQuery(myFirstArgument=form.criteria,
> mySecondArgument=form.moreData) />
> 
> 2) Unnamed arguments. Here you just put in the variables in the same
> order in which you specify the arguments in the function.
> <cfset myQuery = someObject.getMyQuery(form.criteria,form.moreData) />
> 
> 3) Argument collection. Here you first build up a structure that holds
> the arguments. Structure keys match the argument names.
> <cfset myStruct = structNew() />
> <cfset myStruct.myFirstArgument = form.criteria />
> <cfset myStruct.mySecondArgument = form.moreData />
> <cfset myQuery = someObject.getMyQuery(argumentCollection=myStruct) />



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:307830
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