Locktable command

Hi, if you read the c/side help in Navision it states about the command locktable that when Locktable command is issued the tables is locked. But if you run the following piece of code you will find that the table isn’t locked: table1.locktable; if confirm(‘A’) then; But if you have a line between locktable and confirm that states table1.find(’-’); the table will be locked. I run the code on one client and on a other client that manually tries to modify a record in table1. In scenario 1 the other client can change data but not in scenario2. Am i misunderstanding anything or is there a fault in Navisions help? Here is the help text taken from Navision Attain 3.10A: — The following examples show how to use the LOCKTABLE function. Without the VersionCheck parameter: This example uses pseudo-language to show the scope of write locks. Both an explicit lock and an automatic lock are illustrated. The first line (1) explicitly locks table A. If this explicit lock was not set on table A, the DBMS would automatically lock this table when a record was inserted (3). Table B is not locked explicitly, but is locked automatically by the DBMS when a record is inserted (4). Both locks are active until the system exits the C/AL code module (5). BeginWriteTransaction LockTable(TableA) (1) FindRec(TableA, …) (2) . . InsertRec(TableA,…) (3) . InsertRec(TableB) (4) . . EndWriteTransaction (5) — Best regards Daniel

The table (or - in the case of SQL Server: the record) is not locked until it is actually accessed (FIND, GET, …). So the LOCKTABLE statement in itself could be viewed as a command to “change the behavior” of the FIND/GET/… statement rather than a command to actually lock the table. - Jens