I would put the CFTRANSACTION before the first CFINCLUDE and /CFTRANSACTION after the last CFINCLUDE (in other words, at the level of the CASE statement)
You can also do it with the database instead of ColdFusion, for example in M$ SQL: <cfquery name="UpdateAWads" datasource="#REQUEST.Member_DSN#"> SET NOCOUNT ON BEGIN TRANSACTION UPDATE AWads SET AdImpressions=AdImpressions + 1, AdRan=GetDate(), AdCTR=convert(money,AdClickThrus)/convert(money,AdImpressions) WHERE AdID=#AdID# UPDATE AWmonthCharge SET CurrentCharge=convert(money,CurrentCharge) + convert(money,#cost#) WHERE CampaignID=#CampaignID# AND YearID=#Year1# AND MonthID=#Month1# UPDATE MAX_ID SET tbl_AWimpressions = tbl_AWimpressions + 1 DECLARE @MAX INT SELECT @MAX = tbl_AWimpressions FROM MAX_ID INSERT INTO AWimpressions(AdID,ImpPos,ImpCost,ImpID) VALUES(#AdID#,#Row#,#cost#,@MAX) COMMIT TRANSACTION SET NOCOUNT OFF </cfquery> best, paul At 09:54 AM 1/3/03 -0600, you wrote: >I have several insert query statements that are CFIncluded as separate files >inside a single CFCase statement. >cfcase. >cfinclude = "qry_insert1.cfm". >cfinclude = "qry_insert2.cfm". >cfinclude = "qry_insert3.cfm". >cfinclude = "qry_insert4.cfm". >/cfcase. > >Can I put "cftry" and "cftransaction begin" in the first include >and put the end tags /cftry /cftransaction in the last include? > >Would anyone have a way to manage multiple inserts such that they all >rollback if anyone of them fails? Is the above the wrong approach? > >Greg M > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com