Thanks Barney .... will try that out :) I also found an old reply by you on a similar topic "RE: <cftransaction> <cftry> order Barney Boisvert Thu, 29 May 2003 09:43:52 -0700"
:) Regards, Arsalan -------------------------------------------------- From: "Barney Boisvert" <bboisv...@gmail.com> Sent: Tuesday, July 28, 2009 1:00 PM To: "cf-talk" <cf-talk@houseoffusion.com> Subject: Re: CFTRANSACTION with MS Access Database > > The CFTRANSACTION tag takes care of the top-level rollback all on it's > own. The explicit rollback is only used if you have logic inside the > CFTRANSACTION tag that needs to roll back because of some > non-exception situation. So you'll get the behaviour you want if you > remove the CFTRY..CFCATCH stuff and just use the main CFTRANSACTION > block. > > cheers, > barneyb > > On Mon, Jul 27, 2009 at 11:54 PM, Arsalan Tariq > Keen<arsalk...@hotmail.com> wrote: >> >> Dear Fellows, >> >> I am trying to use CFTRANSACTION for a multiple insert query to the same >> datasource but obviously different tables. Now my need is that if any one >> of the INSERT query fails, all the other queries must be rolled-back. If >> all of them succeed, then the complete transaction should be committed. >> Also, I want to catch the DATABASE error if any occurs in the transaction >> using CFTRY for the smooth processing of my CFML page. >> >> Now I have tried something like the following code: >> >> >> <cftry> >> >> <!---//Starting Transaction -----------------------------------------> >> <cftransaction> >> >> <!---//Query##1 Insert ----> >> <cfquery name="insertDAP" datasource="#data2#"> >> INSERT statement >> </cfquery> >> >> <!---//Query##2 Insert --------> >> <cfquery name="insertMW" datasource="#data2#"> >> INSERT statement >> </cfquery> >> >> </cftransaction> >> >> <cfcatch type="database"> >> <!---//Actions to perform if DATABASE error occurs-----> >> <cftransaction action="rollback" /> >> </cftry> >> >> This code gives the error that the cftransaction tag with empty body must >> be nested inside another CFTRANSACTION block. If I do so, then I get an >> error for the CFTRY tag that it must have atleast one CFCATCH block. >> >> Any remedies.... where am I going wrong? >> >> Regards, >> Arsalan >> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325026 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4