J
Jonathan Wood
I've been unable to find any information on this:
If I create a SqlTransaction object with a using block, is calling Rollback
completely necessary if an exception occurs? It's hard to imagine that an
error that causes the using block to exit before encountering a Commit would
result in anything other than a rollback.
I know Rollback is preferred, but calling it from catch is a bit dicey. For
one thing, if I create the transaction object in a using block, then it
won't be available in a catch statement outside of that block. And for
another thing, I'd need another try/catch to handle any errors if the
Rollback fails.
Thanks for any tips.
Jonathan
If I create a SqlTransaction object with a using block, is calling Rollback
completely necessary if an exception occurs? It's hard to imagine that an
error that causes the using block to exit before encountering a Commit would
result in anything other than a rollback.
I know Rollback is preferred, but calling it from catch is a bit dicey. For
one thing, if I create the transaction object in a using block, then it
won't be available in a catch statement outside of that block. And for
another thing, I'd need another try/catch to handle any errors if the
Rollback fails.
Thanks for any tips.
Jonathan