Board index » delphi » Transaction control in Paradox. Is there ?

Transaction control in Paradox. Is there ?

Hi,

Anyone knows some mechanism or component to simulate transaction control in
Paradox tables ?

Thanks

Jerry - Brazil

 

Re:Transaction control in Paradox. Is there ?


Try out following functions coming with Delphi 3

With ATable Do
Try
 DataBase.StartTransaction;

 //Operation like Edit/Append/Delete

 ApplyUpDates;

 DataBase.Commit; //raises a EDatabaseError if fails

Except
 On E:EDataBaseError Do
 Begin
  DataBase.RollBack;
  //Anycode
 End;
End;

ATable.CommitUpDates;  

The CachedUpdates property of TTable has to be set on TRUE

This works fine

Re:Transaction control in Paradox. Is there ?


Thanks Appeldorn, it works fine...

More a question:

It works using a TQuery in request live mode and another SQL statement in
before post event ?

eg:

Query1.Post;
.
.
procedure TForm1.Query1BeforePost(DataSet: TDataSet);
begin
   Database.StartTransaction;
   Try
     Query2.ExecSQL;  // Operation like Insert/Update/Delete
   Except
     DataBase.Rollback;
   End;
end;

procedure TForm1.Query1AfterPost(DataSet: TDataSet);
begin
  DataBase.Commit;
end;

procedure TForm1.Query1PostError;
begin
  DataBase.Rollback;
end;

Thanks.

Re:Transaction control in Paradox. Is there ?


Uses TDatabase component  with dirty commited property to do transaction
operation!

Quote
Jerry Adriane Goncalves wrote:
> Hi,

> Anyone knows some mechanism or component to simulate transaction control in
> Paradox tables ?

> Thanks

> Jerry - Brazil

Other Threads