Re: Easy CFC question (I hope)
adduser is set to ""...unless i missed it, i do't see it being assigned the return value of the query. If you are supposed to be returning the new ID then you would want Eric On Thu, May 9, 2013 at 10:49 AM, Bruce Sorge wrote: > > 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: > > returntype="query"> > > > > > > > > > > > > > > datasource="bhsrecruitadmindsn"> > INSERT INTO users > (username, userpwd, fname, lname, email, > secureHash) > VALUES ('#arguments.username#', '#securepwd#', > '#arguments.fname#', '#arguments.lname#', '#arguments.email#', > '#secureHash#') > > > > > > > SELECT fname, lname, email, secureHash > FROM users > WHERE userid = #newID# > > > > > > The information enters into the db as expected, but when I invoke the > component on the other end: > > returnvariable="userinfo"> > > > > > > > > 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:355682 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Easy CFC question (I hope)
Bruce I wouldn't sweat about making a rookie mistake.We all do. Mine is usually confusing 'eq' and '='. as in ... and I usually find out I've got them the wrong way round when I get an error message. You'd think something as simple as that would be easy to remember, if only because it trips me up so many times.But no. So don't worry about it. Anyway, any programmer that tells you they usually write code that works first time as advertised is quite probably a liar. What is important is to learn how you diagnose your own errors and fix them yourself before anyone else gets involved. You're going to keep making mistakes, either simply syntax mistakes or errors in code logic.The skilled programmers learn how to look for potential minefields as they go, and check each segment of code as they develop, so the finished code is as robust as it's possible to be before they let anyone else test it.That way they get the reputation of being invincible. It's all smoke and mirrors though. They're not invincible - they just paper over the cracks before anyone sees (to mix metaphors). Cheers Mike Kear Windsor, NSW, Australia Adobe Certified Advanced ColdFusion Developer AFP Webworks http://afpwebworks.com ColdFusion Enterprise, PHP, ASP, ASP.NET hosting from AUD$15/month On Fri, May 10, 2013 at 2:12 AM, Bruce Sorge wrote: > > Already done. And I'm stepping away from the computer or a bit. Heh. > > Sent from my iPhone 4S. > > On May 9, 2013, at 12:10 PM, "DURETTE, STEVEN J" wrote: > > > > > You might want to remove the since it isn't > used then. Clean code is easier to troubleshoot. > > > > That's just my .01 (I'm too cheap to give 2 cents!) LOL. > > > > -Original Message- > > From: Bruce Sorge [mailto:sor...@gmail.com] > > Sent: Thursday, May 09, 2013 12:06 PM > > To: cf-talk > > Subject: Re: Easy CFC question (I hope) > > > > > > I just did what dave and morgan suggested and it worked like a charm. > Embarrassed that I made this beginner mistake. I have about six or so more > functions above this one that all work fine, just didn't pay attention to > details on this one. > > > > 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:355681 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Easy CFC question (I hope)
Already done. And I'm stepping away from the computer or a bit. Heh. Sent from my iPhone 4S. On May 9, 2013, at 12:10 PM, "DURETTE, STEVEN J" wrote: > > You might want to remove the since it isn't used > then. Clean code is easier to troubleshoot. > > That's just my .01 (I'm too cheap to give 2 cents!) LOL. > > -Original Message- > From: Bruce Sorge [mailto:sor...@gmail.com] > Sent: Thursday, May 09, 2013 12:06 PM > To: cf-talk > Subject: Re: Easy CFC question (I hope) > > > I just did what dave and morgan suggested and it worked like a charm. > Embarrassed that I made this beginner mistake. I have about six or so more > functions above this one that all work fine, just didn't pay attention to > details on this one. > > 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:355680 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Easy CFC question (I hope)
Chnage to -Original Message- From: Dave Watts [mailto:dwa...@figleaf.com] Sent: 09 May 2013 16:57 To: cf-talk Subject: Re: Easy CFC question (I hope) > returntype="query"> ... > > SELECT fname, lname, email, secureHash > FROM users > WHERE userid = #newID# > > > > > > The information enters into the db as expected, but when I invoke the component on the other end: > > > > > > > > > > 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: 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
RE: Easy CFC question (I hope)
You might want to remove the since it isn't used then. Clean code is easier to troubleshoot. That's just my .01 (I'm too cheap to give 2 cents!) LOL. -Original Message- From: Bruce Sorge [mailto:sor...@gmail.com] Sent: Thursday, May 09, 2013 12:06 PM To: cf-talk Subject: Re: Easy CFC question (I hope) I just did what dave and morgan suggested and it worked like a charm. Embarrassed that I made this beginner mistake. I have about six or so more functions above this one that all work fine, just didn't pay attention to details on this one. 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:355678 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Easy CFC question (I hope)
> Actually up higher he does a so he is actually > returning a variable. He can solve it either > using your way or by doing a before the > cfreturn. I didn't see that. I would recommend against creating a variable with the same name as the component, though. 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:355677 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Easy CFC question (I hope)
I just did what dave and morgan suggested and it worked like a charm. Embarrassed that I made this beginner mistake. I have about six or so more functions above this one that all work fine, just didn't pay attention to details on this one. Bruce On May 9, 2013, at 12:02 PM, "DURETTE, STEVEN J" wrote: > > Actually up higher he does a so he is actually > returning a variable. He can solve it either using your way or by doing a > before the cfreturn. > > I just mention this because if he inspected the results he wouldn't get back > that he was returning an instance of the component, just a simple variable. > > I know a lot of people who declare some sort of return variable and set it at > the end just before returning. > > Steve > ~| 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:355676 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Easy CFC question (I hope)
Actually up higher he does a so he is actually returning a variable. He can solve it either using your way or by doing a before the cfreturn. I just mention this because if he inspected the results he wouldn't get back that he was returning an instance of the component, just a simple variable. I know a lot of people who declare some sort of return variable and set it at the end just before returning. Steve -Original Message- From: Dave Watts [mailto:dwa...@figleaf.com] Sent: Thursday, May 09, 2013 11:57 AM To: cf-talk Subject: Re: Easy CFC question (I hope) 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: 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:355674 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Easy CFC question (I hope)
Damn it. Stupid rookie mistake. Sent from my iPhone 4S. On May 9, 2013, at 11:55 AM, morgan lindley wrote: > > Change your return to: > > > As you have it, it's attempting to return a reference to the adduser method. > > > ~| 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:355673 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Easy CFC question (I hope)
> returntype="query"> > ... > > SELECT fname, lname, email, secureHash > FROM users > WHERE userid = #newID# > > > > > > The information enters into the db as expected, but when I invoke the > component on the other end: > > returnvariable="userinfo"> > > > > > > > > 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: 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:355672 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Easy CFC question (I hope)
Change your return to: As you have it, it's attempting to return a reference to the adduser method. ~| 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:355671 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm