Function NetErr() Foundation
Determines whether an error in a network command has occurred.
NetErr( [<lNewStatus>] ) --> lError
The return value of NetErr() is .T. (true) when an error has occurred during one of the commands USE or APPEND BLANK. Otherwise .F. (false) is returned.
The function NetErr() reads or sets the status variable of the current work space which indicates that an error occurred during one of the commands USE, USE...EXCLUSIVE or APPEND BLANK in network operation. If an error occurs during one of these commands, a run time error is generated. The default error handling routine in Xbase++ handles this error by calling NetErr(.T.). NetErr() is set in the following situations:
Command | Error situation |
---|---|
APPEND BLANK | File is closed or a record lock is active for the data record LastRec()+1. |
USE...EXCLUSIVE | File is already opened exclusively by another user. |
USE | File is already opened by another user. |
// The example illustrates the various error situations
// in which NetErr() is used.
PROCEDURE Main
USE Customer NEW EXCLUSIVE // Exclusive use for the
IF ! NetErr() // creation of index files
INDEX ON CustNo TO CustA
INDEX ON Upper(Lastname+Firstname) TO CustB
CLOSE Customer
ELSE
? "File is already open"
? "Index files not updated"
ENDIF
USE Customer SHARED NEW // SHARED use
IF ! NetErr()
SET INDEX TO CustA, CustB
ELSE
? "File is currently locked"
ENDIF
IF Select("Customer") > 0 // Insert new data record
SELECT Customer
APPEND BLANK
IF ! NetErr()
REPLACE CustNo WITH "123456" ;
Name WITH "Schroeder"
ELSE
? "File is currently locked"
? "Data is not saved"
ENDIF
ENDIF
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.