A typical use of LOCKTABLE(TRUE,TRUE)
in Classic
Database Server is shown in the first of the following examples.
The equivalent code for the SQL Server Option is shown in the
second example. The code that works on both servers is shown in the
third example. The RECORDLEVELLOCKING
property is used
to detect whether record level locking is being used. If this is
the case, then you are using the SQL Server Option for Microsoft
Dynamics NAV. This is currently the only server that supports
record level locking.
Classic Database Server
Example 1
Copy Code | |
---|---|
IF Rec.FIND('-') THEN REPEAT UNTIL Rec.NEXT = 0; Rec.LOCKTABLE(TRUE,TRUE); IF Rec.FIND('-') THEN REPEAT Rec.MODIFY; UNTIL Rec.NEXT = 0; |
SQL Server
Example 2
Copy Code | |
---|---|
Rec.LOCKTABLE; IF Rec.FIND('-') THEN REPEAT UNTIL Rec.NEXT = 0; IF Rec.FIND('-') THEN REPEAT Rec.MODIFY; UNTIL Rec.NEXT = 0; |
Both Server Types
Example 3
Copy Code | |
---|---|
IF Rec.RECORDLEVELLOCKING THEN Rec.LOCKTABLE; IF Rec.FIND('-') THEN REPEAT UNTIL Rec.NEXT = 0; IF NOT Rec.RECORDLEVELLOCKING THEN Rec.LOCKTABLE(TRUE,TRUE); IF Rec.FIND('-') THEN REPEAT Rec.MODIFY; UNTIL Rec.NEXT = 0; |