Detect a concurrency conflict.
XSharp.Core (in XSharp.Core.dll) Version: 2.18
Syntax Request Example
FUNCTION NetErr() AS LOGIC
public static bool NetErr()
TRUE if a concurrency conflict occurs or if programmatically set to TRUE via the lNewError
argument; otherwise, FALSE.
The initial value is FALSE.
NetErr() is a global flag set by certain operations that is used to test for concurrency control conflicts in the following situations:
NetErr() is TRUE
Append a blank record with APPEND BLANK or DBAppend()
If another process has a file lock in place or a record lock of LastRec() + 1 (with, for example, a simultaneous append blank operation)
File open in either shared or exclusive mode (with, for example, USE or DBUseArea())
If another process has exclusive use of the file
File open in exclusive mode (with, for example, USE...EXCLUSIVE or DBUseArea() with lShared set to FALSE)
If another process has the file open, in either shared or exclusive mode
Internally, these situations result in a runtime error, invoking the installed error handler.
The source code for the default error handler, defined in the ERRORSYS.PRG file located in your X# \SAMPLES directory, does not display an error message in these cases, allowing your application to continue.
NetErr() is generally applied in a program by testing one of these operations.
If the function returns FALSE, you can perform the next operation.
Otherwise, you must handle the error either by retrying the operation or by terminating it with a BREAK or RETURN.
This example demonstrates typical usage of NetErr().
If the USE succeeds, the index files are opened and processing continues.
If the USE fails, a message is displayed, and control returns to the nearest BEGIN SEQUENCE construct:
1USE customer SHARED NEW
3 SET INDEX TO custnum, custorders, custzip
5 ? "File is in use by another"