SET LOCK Command
Enables or disables automatic file locking in certain commands.
SET LOCK ON | OFF
- Specifies that the commands listed below automatically lock the table when they execute. This provides read-only access to other users on the network and ensures that you are using the most current data.
- (Default) Enables shared access of tables with commands listed below. Use SET LOCK OFF if you don't need the most current information from a table.
Visual FoxPro doesn't place a lock on a file when executing commands that require read-only access to a table. These commands include the following:
|AVERAGE||JOIN (both files)|
|COPY TO ARRAY||REPORT|
|DISPLAY (with a scope)||SUM|
While they are executed, these commands don't change the contents of a table, and access to the table is available to other users on the network. Thus, the table can be changed while you are executing one of these commands. For example, you might begin printing a report by using REPORT before another user changes a record included in the report. Your report now contains outdated information.
SET LOCK is scoped to the current data session.