Microsoft KB Archive/92345

= Using File Locking and Record Locking in FoxPro =

Article ID: 92345

Article Last Modified on 12/3/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft FoxPro 2.0
 * Microsoft FoxPro 2.5b for MS-DOS
 * Microsoft FoxPro 2.5a
 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.5a

-



This article was previously published under Q92345



SUMMARY
When a command requires a file lock and the corresponding file is not already locked, FoxPro attempts to lock the file. Similarly, when a command requires a record lock and the corresponding record is not already locked, FoxPro attempts to lock the record. If the lock attempt is successful, FoxPro executes the command and releases the lock.

For a list of commands that automatically lock a file or individual records, see the table below.

Use manual locking commands in the following situations:


 * When you are editing a database with the CHANGE or EDIT command and a format file.
 * When you are editing a database using a memory variable and a command such as SCATTER. Note that the GATHER command locks each record as it updates the database; however, not locking the record during the editing process can introduce data-integrity problems.



MORE INFORMATION
The following commands automatically lock a file or individual records, as indicated:   Command             Type of Locking ---

APPEND             Locks current record

APPEND BLANK       Locks database header (briefly)

APPEND FROM        Locks entire database   APPEND FROM ARRAY   Locks database header

APPEND MEMO        Locks current record

BROWSE             Locks current record and all records from fields in                       related databases (specified by an alias) once the user begins editing a field

CHANGE (without a  Locks current record and all records from fields in   format file)        related databases (specified by an alias) once the user begins editing a field

DELETE             Locks current record

DELETE NEXT 1      Locks current record

DELETE RECORD   Locks record 

DELETE 

EDIT (without a    Locks current record and all records from fields in   format file)        related databases (specified by an alias) once the user begins editing a field

GATHER             Locks current record

INSERT-SQL         Locks database header

MODIFY MEMO        Locks current record when editing begins

READ               Locks current record (and all records from aliased                       fields)

RECALL             Locks current record

RECALL NEXT 1      Locks current record

RECALL RECORD   Locks record 

RECALL 

REPLACE            Locks current record (and all records from aliased                       fields)

REPLACE NEXT 1     Locks current record (and all records from aliased                       fields)

REPLACE RECORD  Locks record  (and all records from aliased                       fields)

REPLACE          fields)

SHOW GETS          Locks current record (and all records from aliased                       fields)

UPDATE             Locks entire database

Additional query words: VFoxWin FoxDos FoxWin 2.x multi-user kbvfp300 kbvfp500 6 6 multiuser network networking automatic

Keywords: KB92345

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.