General X++ Development
How do I prevent partial database updates when an error occurs?
How do I prevent partial database updates when an error occurs?
1 answer
Write an answerPut related writes inside the same transaction.
ttsBegin;
header.update();
line1.update();
line2.update();
ttsCommit;If one of those operations throws and the exception escapes the transaction, the transaction is rolled back instead of leaving half the operation committed.
That is exactly what ttsBegin/ttsCommit is for.
Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer