Hey, I am doing a project for my CF class in college. I admit that I have not played with CFC's in a while, but I cannot figure out why this is not working:
<cffunction name="adduser" hint="Adds a new user to the database" returntype="query"> <cfargument name="fname" required="true" type="string"> <cfargument name="lname" required="true" type="string"> <cfargument name="username" required="true" type="string"> <cfargument name="userpwd" required="true" type="string"> <cfargument name="email" required="true" type="string"> <cfset var adduser = "" /> <!--- Hash the password and create a random number for the URL on the email that will be sent ---> <cfset securepwd = #hash(arguments.userpwd)# /> <cfset salt = "#Rand("SHA1PRNG")#" /> <cfset secureHash = hash(salt) /> <cfquery name="qUserID" result="userid" datasource="bhsrecruitadmindsn"> INSERT INTO users (username, userpwd, fname, lname, email, secureHash) VALUES ('#arguments.username#', '#securepwd#', '#arguments.fname#', '#arguments.lname#', '#arguments.email#', '#secureHash#') </cfquery> <!--- Set the auto generated key ---> <cfset newID = #userid.generated_key# /> <!--- Now we get the informatoion from the db ---> <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. Also, I know that there are a few things that could be fixed/tidied up regarding hashing and such, but this class is not on encryption or anything like that, it's so that the instructor see's that I have a basic understanding of CF. The book for the class is CFWAC for version 9, so it's beginner level stuff. Bruce ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:355669 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm