> I am planning to shift all the queries to one .cfc file. I am confused what > if I have to pass the form values to the function in the .CFC files. > > <cffunction name="AddData" returntype="any"> > <cfset var Qry_Data ="" > > <cfquery name="Qry_Data" datasource="Platform" > > INSERT INTO tblWebSiteBrand (FirstName,LastName,Phone) > VALUES (<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value='#form.FirstName#'>, > <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value='#form.LastName#'>, > (<cfqueryparam cfsqltype="CF_SQL_INTEGER" value='#form.Phone#'>, > </cfquery> > <cfreturn Qry_Data> > </cffunction>
That will actually work as-is. However, you're better off passing in parameters rather than referencing external scopes from within your functions: <cffunction name="addData" ...> <cfargument name="firstName" type="string" required="yes"> <cfargument name="lastName" type="string" required="yes"> <cfargument name="phone" type="string" required="yes"> ... </cffunction> Then, when you invoke addData, you'd pass in the appropriate variables from your form. The advantage of this approach is that your component is more loosely coupled with the page that calls it. You might later want to pass data from somewhere other than a form, and you could then do that without changing your component. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:320023 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

