Board index » delphi » User Transaction already in progress

User Transaction already in progress

 I have two tables BillMst,Invtrn (TTable)and  BillDatabase(TDatabase)
User can edit the values of BillMst through  DBEdit controls.When the
user Saves the Transaction.I had given
   BillDatabase.StartTransaction;

  // Editing BillMst,Invtrn...

   BillDatabase.ApplyUpdates([BillMst,Invtrn]);
This line gives me an error A User Transaction already in progress
  If I separetly give BillMst.ApplyUpdates,Invtrn.ApplyUpdates
 Why this error is comming can any body give me a proper solution.
I am using D4 Paradox7.0

 

Re:User Transaction already in progress


You are trying to start a transaction when one has already been started.
Add
        if not BillDatabase.InTransaction then
                BillDataBase.StartTransaction....
Quote
Ashish wrote:

>  I have two tables BillMst,Invtrn (TTable)and  BillDatabase(TDatabase)
> User can edit the values of BillMst through  DBEdit controls.When the
> user Saves the Transaction.I had given
>    BillDatabase.StartTransaction;

>   // Editing BillMst,Invtrn...

>    BillDatabase.ApplyUpdates([BillMst,Invtrn]);
> This line gives me an error A User Transaction already in progress
>   If I separetly give BillMst.ApplyUpdates,Invtrn.ApplyUpdates
>  Why this error is comming can any body give me a proper solution.
> I am using D4 Paradox7.0

Re:User Transaction already in progress


Ashish,
tDatabase.ApplyUpdates does apply updates
within a transaction - consult the online help.
As you already have the transaction active,
you get the error. TBDEDataset.ApplyUpdates, on the
other hand, does not start transaction. This is why
your second approach passes without error.
--
Roman
(please remove 'stopspam' in header when replying)
mail: i...@rksolution.cz
URL: www.rksolution.cz

Ashish p1e ve zprv <81h3uo$i...@forums.borland.com>.

Quote

> I have two tables BillMst,Invtrn (TTable)and  BillDatabase(TDatabase)
>User can edit the values of BillMst through  DBEdit controls.When the
>user Saves the Transaction.I had given
>   BillDatabase.StartTransaction;

>  // Editing BillMst,Invtrn...

>   BillDatabase.ApplyUpdates([BillMst,Invtrn]);
>This line gives me an error A User Transaction already in progress
>  If I separetly give BillMst.ApplyUpdates,Invtrn.ApplyUpdates
> Why this error is comming can any body give me a proper solution.
>I am using D4 Paradox7.0

Re:User Transaction already in progress


The TDatabase.ApplyUpdates method automatically starts and commits a
transaction for you so you do not need to do so.

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Re:User Transaction already in progress


But How will I overcome this situation. Whether the TBDEDataset.ApplyUpdates
is the proper way.

Re:User Transaction already in progress


Sorry but I do not understand your question.

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Re:User Transaction already in progress


I want the user to edit in the DBControl, and Start a Transaction Only when
the user Press the Post Button.
But When any error is done I want to roll Back the entries whatever the user
had enterd in the DBControls.
Quote
Bill Todd (TeamB) wrote in message <81n8qa$4l...@forums.borland.com>...
>Sorry but I do not understand your question.

>--
>Bill

>Bill Todd (TeamB)
>(TeamB cannot respond to questions received via email)

Re:User Transaction already in progress


Calling TDatabase.ApplyUpdates in the AfterPost event handler should do that
for you. It will start a transaction, attempt to apply the updates and if
they are successful commit the transaction. If there are errors it will
rollback.

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Other Threads