Hi, all... still trying to get a handle on using CFC's. Here's an update method I wrote and I'd like to know what can be changed to make it better. Such as, why not use the form scope in the query? And, why not just use the application scope for the dsn, instead of converting it to the variables scope?
If components have access to the url, form, session, and application scopes, etc., why not use them in the component? What's the benefit of converting them? <cffunction name = "update_product" displayname = "update_product" hint = "Update specified product" output = "false"> <cfargument name="product_id" type="string" required="yes"> <cfset variables.product_id = "#arguments.product_id#"> <cfquery name = "qUpdateProduct" datasource="#application.dsn#"> update products set name = <cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.name#">, description = <cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.description#">, regular_price = <cfqueryparam cfsqltype = "cf_sql_decimal" value = "#form.regular_price#" scale = "2">, featured = <cfqueryparam cfsqltype = "cf_sql_char" value = "#form.featured#">, special = <cfqueryparam cfsqltype = "cf_sql_char" value = "#form.special#">, special_price = <cfqueryparam cfsqltype = "cf_sql_decimal" value = "#form.special_price#" scale = "2">, photo_150 = <cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.photo_150#">, photo_400 = <cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.photo_400#"> where product_id = "#variables.product_id#" </cfquery> </cffunction> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:314213 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4