Multiple ORM statements in one transaction

Home Forums kbmMW Multiple ORM statements in one transaction

Viewing 1 reply thread
  • Author
    Posts
    • #54205
      mrluigi2017
      Participant

      Hi,

      How can I use the same transaction for multiple orm methods? I saw that I can pass a transaction, but I don’t know how to obtain it.

      Thanks in advance.

      Kind regards,

      Luigi

    • #54213
      kimbomadsen
      Keymaster

      Hi,

      var
      tx:TkbmMWTransaction;
      begin
      tx:=TkbmMWTransaction.Create;
      try
      tx.StartTransaction;
      try
      ORM.Insert(data,…,tx);
      ORM.Insert(data2,…,tx);
      tx.CommitTransaction;
      except
      tx.RollbackTransaction;
      end;
      end;

      best regards

      Kim/C4D

Viewing 1 reply thread
  • You must be logged in to reply to this topic.
Skip to toolbar