Add to that list, locally scope the query. <cfset var get = "">
Adrian -----Original Message----- From: Peter Boughton [mailto:[EMAIL PROTECTED] Sent: 01 October 2008 00:01 To: cf-talk Subject: Re: cfqueryparam within a cfc > <cfcomponet> > <cffunction name="function"> > <cfargument name="field_value" type="numeric" required="yes"> > > <cfquery name="get"> > SELECT * FROM TABLE WHERE field = <cfqueryparam value="#field_value#" > cfsqltype="cf_sql_integer"> > </cfquery> > </cffunction> > </cfcomponent> > > Is this over-kill or good practice? Use it always - it's safer and simpler that way. Since you're asking about good practice, I want to pick on a couple of things in your example. ;) First, the "SELECT *" - bad! You shouldn't ever use "SELECT *" in code. (Name just the fields you need; even if you need them all, name them anyway - it also helps readability and I've heard a couple of times of obscure bugs caused by "SELECT *" use.) Second, that should be Arguments.field_value - always scope variables. (Again, scoping helps performance, helps readability, and helps avoid annoying bugs.) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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-talk/message.cfm/messageid:313315 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

