Board index » delphi » A user transaction is already in progress?

A user transaction is already in progress?

Please Help!

I've written a component that uses cached updates.  Its' data module
contains both the TDataBase and alll of the TQueries and TUpdateSQL.  It
works great.

I enhanced the component and published a TDataBase property, allowing a user
to pass in their own database connection.  It works great EXCEPT when I
write the changes.  Thats when I get the "user transaction is already in
progress error".

The code that writes it is the usual:

with FDataBase do begin
  StartTransaction;
  try
    CommitUpdates([query1, query2 ...]);
    Commit;
  except
     Rollback;
  end;
end;

The error message actually occurs on the CommitUpdates([]) statement.

Thank you very much for any suggestions.

 

Re:A user transaction is already in progress?


Take a look at CommitUpdates source.
I guess it does transactions itself.

Regards,
Mike Hodos

Quote
Scott Cruikshank wrote in message <7jokv9$8...@forums.borland.com>...
>Please Help!

>I've written a component that uses cached updates.  Its' data module
>contains both the TDataBase and alll of the TQueries and TUpdateSQL.  It
>works great.

>I enhanced the component and published a TDataBase property, allowing a
user
>to pass in their own database connection.  It works great EXCEPT when I
>write the changes.  Thats when I get the "user transaction is already in
>progress error".

>The code that writes it is the usual:

>with FDataBase do begin
>  StartTransaction;
>  try
>    CommitUpdates([query1, query2 ...]);
>    Commit;
>  except
>     Rollback;
>  end;
>end;

>The error message actually occurs on the CommitUpdates([]) statement.

>Thank you very much for any suggestions.

Re:A user transaction is already in progress?


You should do ApplyUpdates before Commit, not CommitUpdates. Then, if
succesful, do CommitUpdates.
Quote
Scott Cruikshank wrote in message <7jokv9$8...@forums.borland.com>...
>Please Help!

>The code that writes it is the usual:

>with FDataBase do begin
>  StartTransaction;
>  try
>    CommitUpdates([query1, query2 ...]);
>    Commit;
>  except
>     Rollback;
>  end;
>end;

>The error message actually occurs on the CommitUpdates([]) statement.

>Thank you very much for any suggestions.

Re:A user transaction is already in progress?


Hi Scott!

On Thu, 10 Jun 1999 11:24:10 -0400, "Scott Cruikshank"

Quote
<scottcruiksh...@yahoo.com> wrote:
>with FDataBase do begin
>  StartTransaction;
>  try
>    CommitUpdates([query1, query2 ...]);
>    Commit;
>  except
>     Rollback;
>  end;
>end;

Just write ...

        ApplyUpdates([query1, query2 ...]);

instead of ...

         CommitUpdates([query1, query2 ...]);

tomi.

Other Threads