This is an article discussion thread for discussing the SitePoint article, "ColdFusion Components - An Introduction"
| SitePoint Sponsor |
This is an article discussion thread for discussing the SitePoint article, "ColdFusion Components - An Introduction"
Just letting you know you have a syntax error in the example. [component="compontents.users.general.users"] Should obviously read [component="components.users.general.users"]
(spelled components as compontents)
take care.
I am wondering how to return an error message from a CFC function which has a return type of QUERY. If I want to return a database error how do I do it? The function will want to return a query not a message string.
I have tried to write a generic return routine that handles messages as well as data. I have put that routine in a base component and all other components extend that base component. Unfortunately I can't get it to work. It keeps telling me the object I have assigned the CFC to is undefined.
I'd love to know how you have written this into your CFCs.
Many thanks,
Lazz.
lots of thanx 2 ERIC
It was relly helpful for me.thanx for the cute tutorial





Lazz...
You could change the return type of your CFC from query, to structure, then add in any error messages too, maybe like this:
<cfset returnStruct = StructNew()>
<cfset returntype.query = myQueryName>
<cfset returntype.error = myErrorMessage>
<cfreturn returnStruct>
Adobe Certified Coldfusion MX 7 Developer
Adobe Certified Advanced Coldfusion MX Developer
My Blog (new) | My Family | My Freelance | My Recipes
Check out <cftry> and <cfcatch> and <cfthrow>. I can get you documentation pages if you need them. but just check out livedocs.macromedia.com.Originally Posted by Lazz
rynoguill
Ryan Guill, AKA Mark Roman
Ive done this sort of thing before too, and it works well as long as you are ready to handle it on the receiving end. The cfthrow will just do a terminating error.Originally Posted by creole
rynoguill
Ryan Guill, AKA Mark Roman
what is the advantage using CFC rather than normal coding in one cfm page
I thought the reasons given in the article were pretty compelling myself...Originally Posted by sabiha chowdhury
Only dead fish go with the flow





But isn't that "outputting from a CFC?" GASP!!!Originally Posted by Rynoguill
Adobe Certified Coldfusion MX 7 Developer
Adobe Certified Advanced Coldfusion MX Developer
My Blog (new) | My Family | My Freelance | My Recipes
thanks a very good tutorial about components in coldfusion
Bookmarks