Hi guys,
If I create a form, with a button, which when this button pushed, it will explode several record into a custom table (inserting).
If I do this in multi-user environment, do I need to lock the custom table ? so that other users won't interfere in the middle of inserting the records ?
Thanks
0
Comments
1) You need to keep correct locking order, but you are accessing the tables in another order...
2) You need to prevent other users to change or access same record you just read (for example, you read last entry no. and you want to insert some new record later in the process, this will prevent other users to read the last record to do same thing, it will be serialized...)
3) You want to be sure that you are reading commited data.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
x := 1
Repeat
If x = 5 Then
Error(Text001)
Else Begin
Table.INIT;
Table."No." := x;
Table.INSERT;
End;
x := x + 1;
Until x = 10;
Does this mean when the program raise error message (x=5) and the application stop, the record for x = 1..4 already inserted into the table ?
or Navision automatically rollback, so that when I open the Table, there won't be any record ?
Thank Guys
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
then when do we use commit command ? cause in several navision code, I see some module using 'commit' command
Places where commit make sense is if you
write your own posting routine.
write integrations with third party system.
batch processing orders.
catching errors in "if CU.run"
openning a form at the end of transaction.
dataports sometimes do not commit, and you have to write on postdataport COMMIT
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.