×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Error Trapping

How can I use CFTRANSACTION by webmigit
Posted: 20 May 04

Speaking about: http://livedocs.macromedia.com/coldfusion/6/CFML_Reference/Tags-pt315.htm

This is not a very good example of how to employ CFTRANSACTION, it does not show how to use the various actions.. Its pretty much a shot in the dark unless you get the livedocs for CF5 (which is more detailed) but following the code there is invalid because cftry requires the last tag executed within itself be cfcatch.. so the method of catching and setting a variable in that method doesn't work.. This is how you need to do it..

CODE

<Cfset gotrue=1>
<cftransaction>
  <cftry>...queries here...
    <cfcatch>...catch the error...
      <cfset gotrue=0>
      <cftransaction action="rollback">
      <cfrethrow> <!---This line throws the error back to your error handler if you have one.. If you don't, you can remove this...--->
    </cfcatch>
  </cftry>
  <cfif gotrue eq 1>
    ...do something...
    <cftransaction action="commit">
  </cfif>
</cftransaction>

Livedocs really needs to improve this page, very badly...

You may also notice that I posted this same comment on the livedocs page. I'm severely disappointed in Macromedia on the documentation of that page.

Back to Adobe FAQ Index
Back to Adobe Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close