How to Use COMMIT function of Database

rambhu_05rambhu_05 Member Posts: 8
Please some one give me example of COMMIT funtion of Database
i know that it use to seperate write transaction in code but unable to understand
what is write transaction please help me ](*,)

Comments

  • lvanvugtlvanvugt Member Posts: 774
    With write transaction is meant any actions that lead to changes in the database. So insertions, deletions or modifications. This applies to both user or code actions, although the term write transactions is mostly used in the context of code actions.

    In general, however, the changes to database should only be effectuated at the end a tranaction, i.e. finalize the write transaction. NAV will do this automatically for you so you will see little to none COMMITs in C/AL code (i.e. an implicit COMMIT). In some case (like in f.e. codeunit 80/90) an explicit COMMIT is needed to already secure the write transaction modifications to the database and release all locks on tables involved in the transaction sofar. But ... this is exceptional. The rule is: do not program a COMMIT unless it's really needed and you know what you are doing.

    You might have a look at this thread: viewtopic.php?f=23&t=39676&p=194158#p194158
    Luc van Vugt, fluxxus.nl
    Never stop learning
    Van Vugt's dynamiXs
    Dutch Dynamics Community
  • BeliasBelias Member Posts: 2,998
    search commit in mibuso/read application designer's guide and MOCs.
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • matttraxmatttrax Member Posts: 2,309
    COMMIT definitely has its purpose, but you should only use it when the occasion calls for it. You probably don't want a COMMIT half way through your transactions and then an error at the end. So just be careful using it. Make sure it's needed.
Sign In or Register to comment.