xHarbour Reference Documentation > Function Reference |
Determines if a database command has failed in network operation.
NetErr( [<lNewStatus>] ) --> lIsNetworkError
The function returns .T. (true) if a database could not be opened or a new record could not be created during concurrent access in a network. Otherwise, the return value is .F. (false).
NetErr() is a function used to detect database errors that may occur with the commands USE, USE...EXCLUSIVE or APPEND BLANK when a database is concurrently accessed by multiple applications in a network. The function maintains a status variable indicating such errors. The status variable is set by xHarbour's default error handling system in following situations:
Possible NetErr() conditions
Failed command | Description |
---|---|
USE | USE EXCLUSIVE is issued by another process |
USE...EXCLUSIVE | USE or USE EXCLUSIVE is issued by another process |
APPEND BLANK | LastRec()+1 is locked with FLock() or Rlock() by another process |
NetErr() returns .T. (true) if a database command failed due to these conditions.
See also: | APPEND BLANK, DbAppend(), DbRLock(), DbUseArea(), FLock(), NetName(), RLock(), USE |
Category: | Database functions , Network functions |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example illustrates the situations where NetErr() is used // to detect possible database access errors in a network: PROCEDURE Main USE Customer ALIAS Cust NEW EXCLUSIVE IF .NOT. NetErr() INDEX ON CustID TO Cust01 INDEX ON Upper(LastName+FirstName) TO Cust02 USE ELSE ? "File cannot be opened exclusively" ENDIF USE Customer ALIAS Cust SHARED NEW IF .NOT. NetErr() SET INDEX TO Cust01, Cust02 ELSE ? "File is exclusively used by another process" ENDIF IF Select( "Cust" ) > 0 SELECT Cust APPEND BLANK IF .NOT. NetErr() REPLACE CustID WITH "X087" , ; Name WITH "Miller" ELSE ? "Record is currently locked by another process" ENDIF ENDIF RETURN
http://www.xHarbour.com