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 ](*,)
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.
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.
Comments
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
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
My Blog - nav.education