Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: FireDac Transcation, First sql executes and not effected with rollback


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Khalil Abdeljawad

Posts: 1
Registered: 9/2/16
FireDac Transcation, First sql executes and not effected with rollback  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 10, 2018 6:39 AM
I have the next code, first ExecSql is always executes and not effected by rollback at all, the second on is Ok, why?


 mainwindow.fdconn.StartTransaction;
// this one always executes:
 
 mainwindow.fdconn.ExecSQL('INSERT INTO K_PURCHASE_INVOICE (id, year, charid, `date`, supplierId, totalprice, nettotal, store, currency,discount, user)'
  + ' values ( :id, :year, :charid, :date, :supplierId, :totalprice, :nettotal, :store, :currency, :discount, :user)',
  [strtoint(maxId) + 1, year, invid, date, accId, totallbl.Caption,
  nettotal.Caption, store.Text, currency.Text, discount.Text, '11056']);
 
 
query := '';
values := '';
 
for i := 1 to itemsGrid.RowCount - 1 do
 
begin
  query := 'INSERT INTO k_purchase_invoice_items values("' + itemsGrid.Cells
    [1, i] + '","' + inttostr(strtoint(maxId) + 1) + '","' + itemsGrid.Cells
    [3, i] + '","' + itemsGrid.Cells[4, i] + '","' + itemsGrid.Cells[8, i] +
    '","' + itemsGrid.Cells[9, i] + '")';
 
     // this is Ok and effected with rollback:
      mainwindow.fdconn.ExecSQL(query);
 
end;
 
mainwindow.fdconn.Rollback;
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02