> I have a set of database updates that I need to nest in a
> cftransaction, but I also want to use a cftry/cfcatch block for error
> handling. If I put the cftransaction outside the try/catch block if
> there is an error, the catch block will execute and abort any further
> processing, if I put the cftrans tags inside the block, is CF smart
> enough to know that the transactions should be rolled back before the
> catch block is executed?
>
> What would be the correct way to do this?

I don't know if there is a "correct" way to do this... Personally I would go
with putting the cftransaction inside the cftry, but that's not really
founded on anything meaningful. If you're just trying to ensure relational
integrity between one inserted record and another which must be added
simultaneously ( from the user's perspective ), you can probably find some
way to get your inserted value from the db without needing a cftransaction
if you use a stored procedure... For instance, in ms sql server you could
use:

insert into mytable ...
set @mykey = scope_identity();

Though generally speaking I could probably provide a more helpful answer if
I knew more about what it is you're doing specifically.



S. Isaac Dealey
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to