Re: Transaction Problem, part two..



Yet more to the puzzle:

Pseudo Code of problem:
- o - o - o- o - o - o - o -
procedure ProcessOrder;
begin
procedure step1;
procedure step2;
procedure step3;
end;

Procedure DoOrder;
begin
try
Mainform.ADOConnection1.begintrans;
CallProcedureA;
CallProcedureB;
CallProcedureC;
ProcessOrder;
Mainform.ADOConnection1.CommitTrans;
except
on E : Exception do
begin
ShowMessage(E.ClassName+' error raised, with message : '+E.Message);
Mainform.ADOConnection1.RollbackTrans;
end;
end;
PrintInvoice;
SendEmailCopy;
end;
- o - o - o- o - o - o - o -

This fails and acts like everything done was executed as a rollback.
If I move the ProcessOrder call to just before the PrintInvoice call, then
everything works.
I have stepped through all this code line-by-line and nothing is out of the
ordinary. I even went as far as placing a try/except block inside the
ProcessOrder procedure with its own transaction protection and that too is
successful if outside the Main transaction try/except.

I just don't want to split these two sets in seperate transactions. They
should be all done or nothing done.

Do all of the procedures protected by transactions have to reside in the
same Unit?

There has to be a simple reason this is failing and I just can't see it.

(sigh)

John



.



Relevant Pages

  • Re: Question about efficiency
    ... By putting my commands into a transaction do you just mean that I say ... (Pseudo Code) ... Do Loads of Update statements one after another ...
    (microsoft.public.dotnet.framework.adonet)
  • Reuse Transaction?
    ... after committing a transaction I'd like to create a new transaction on an existing connection. ... Here's some pseudo code I'm using ...
    (microsoft.public.dotnet.framework.adonet)