Recent

Author Topic: Help with COMMIT  (Read 1420 times)

ramutau

  • New Member
  • *
  • Posts: 40
Help with COMMIT
« on: December 07, 2016, 05:20:24 am »
Hi friends,

Relative newbie here.

I am using Lazarus 1.6 r51630 FPC 3.0.0 i386-win32

I have struggled for hours with getting data from DBEdits on a form to commit to the database (Firebird 2.5). I've got it working, so this is more a question of 'Why is it working like this', than how to get it to work. :-)

This is the piece of code where I commit the transaction.

What I don't understand is; if I leave the if statement to check if the transaction is active, the commit doesn't happen. If I comment it out as below, it works fine (the edited data gets saved to the database).

How the can the COMMIT work if there is no active transaction?

Code: Pascal  [Select][+][-]
  1. procedure TJob_Card_Details.Close_ButtonClick(Sender: TObject);
  2. begin
  3.   //If jms_main_form.JMS_Transaction.Active then
  4.   //begin
  5.     Job_Enquiry_List_Form.Enquiry_List_JobDesc_Dataset.ApplyUpdates;
  6.     jms_main_form.JMS_Transaction.Commit;
  7.     Job_Card_Details.Close;
  8.   //end;
  9.   Job_Enquiry_List_Form.Show;
  10. end;
  11.  








 

TinyPortal © 2005-2018