Lose the cfargument - you don't need it in this case since you aren't passing any arguments to the cfc. Also you don't need access=remote unless you are planning on hitting this cfc with an ajax call, flex etc..
So this would be fine: <cffunction name="getResults" access="public" returntype="query"> <cfquery name="rsEmails" datasource="my_datasource"> SELECT * FROM testing </cfquery> <cfreturn rsEmails> </cffunction> Then invoke the component and output the query on the cfm page: <cfoutput query="rsEmails"> Name - #name# <br /> Email Address - #email_address# </cfoutput> Cheers Will -----Original Message----- From: John Barrett [mailto:[email protected]] Sent: 09 April 2009 09:55 To: cf-newbie Subject: cfc help hi, I have a cfc here and I will like to test it, but I am stuck <cfcomponent> <cffunction name="getResults" access="remote" returntype="query"> <cfargument name="getEmails" type="string" required="yes"> <cfquery name="rsEmails" datasource="my_datasource"> SELECT * FROM testing </cfquery> <cfreturn rsEmails> </cffunction> </cfcomponent> the cfm file <cfinvoke component="testing" method="getResults" returnvariable="rsEmails"> <cfoutput> Name - #name# <br /> Email Address - #email_address# </cfoutput> The error The GETEMAILS parameter to the getResults function is required but was not passed in. My question is how to I fix this to get a cfc to query a DB and to to display the results? Thanks in advanced, John ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4497 Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
