Chnage to <cfreturn qUserEmail>

-----Original Message-----
From: Dave Watts [mailto:[email protected]] 
Sent: 09 May 2013 16:57
To: cf-talk
Subject: Re: Easy CFC question (I hope)


> <cffunction name="adduser" hint="Adds a new user to the database" 
> returntype="query"> ...
>                 <cfquery name="qUserEmail">
>                         SELECT fname, lname, email, secureHash
>                         FROM users
>                         WHERE userid = #newID#
>                 </cfquery>
>
>                 <cfreturn adduser>
>         </cffunction>
>
> The information enters into the db as expected, but when I invoke the
component on the other end:
>
> <cfinvoke method="adduser" component="cfc/dbfunctions"
returnvariable="userinfo">
>         <cfinvokeargument name="username" value="#form.username#">
>         <cfinvokeargument name="userpwd" value="#form.userpwd#">
>         <cfinvokeargument name="fname" value="#form.fname#">
>         <cfinvokeargument name="lname" value="#form.lname#">
>         <cfinvokeargument name="email" value="#form.email#"> 
> </cfinvoke>
>
> I get the error message The value returned from the adduser function 
> is not of type query. If the component name is specified as a return type,
it is possible that either a definition file for the component cannot be
found or is not accessible. The error occurred on line 16.

You specified that the component returns a query object in the first line.
But you're trying to return an instance of the component. You need to change
one or the other. In this case, you probably want to change your CFRETURN to
return the query object:

<cfreturn qUserEmail>

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule,
and provides the highest caliber vendor-authorized instruction at our
training centers, online, or onsite.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355679
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to