I'm working on a toolbox of netfunctions to control
any network-error.
You can open a DBF twice and test the different netfunctions.
Sample 1 : trying to ZAP a DBF
it will show your own defined error-messages.
Sample 2 : trying to RECALL a record that is in use
it will show your own defined error-messages.
I hope it will be usable.
// ---------- NET - FUNCTIONS ----------------------------
// --------------------------------------------------------------------
FUNCTION NET_USE ( cDBName, cAlias, nTrials, lNet )
FUNCTION NET_RLOCK( nTrials )
FUNCTION NET_ULOCK()
FUNCTION NET_FLOCK ( nTrials )
FUNCTION NET_WAIT ( nTrials )
FUNCTION SHOW_WAIT( nTrials, oMeter, oText1 )
FUNCTION NET_DELETE ( nTrials )
FUNCTION NET_RECALL ( nTrials )
FUNCTION NET_APPEND ( nTrials )
FUNCTION NET_PACK( cDBName, cAlias, nTrials )
FUNCTION NET_PACK1( cDBName, cAlias, nTrials )
FUNCTION PACK1()
FUNCTION NET_ZAP( cDBName, cAlias, nTrials )
FUNCTION ZAP1()
FUNCTION NET_CLOSE( nTrials )
FUNCTION NET_ORDER
FUNCTION NET_COPY ( cALIAS, nStart, nEnd, nTrials )
sample : open a DBF
- Code: Select all Expand view RUN
// ---------- NET - FUNCTIONS ----------------------------
// --------------------------------------------------------------------
FUNCTION NET_USE ( cDBName, cAlias, nTrials, lNet )
LOCAL lReturn := .T.
LOCAL lOpen := .F.
LOCAL nTrcount := nTrials
LOCAL YesNo := .F.
// SHARED all Users
// EXCLUSIVE 1 User
IF !File( cDBName )
nMsgBox ("File -> " + cDBName + " is missing !", "Attention !")
SET RESOURCES to
set _3DLOOK OFF
FreeLibrary()
CLOSE DATABASE
QUIT
ENDIF
DO WHILE nTrcount <= nTrials
IF !lNet
USE &cDBName ALIAS &cAlias NEW VIA "DBFCDX" EXCLUSIVE
ELSE
USE &cDBName ALIAS &cAlias NEW VIA "DBFCDX" SHARED
ENDIF
IF !NETERR()
lReturn := .T.
ELSE
IF lNet = .T.
Status := "SHARED"
ELSE
Status := "EXCLUSIVE"
ENDIF
IF nTrcount = nTrials
xName := WNetGetUser()
IF MsgYesNo( "Open " + Status + " of " + upper(cDBName) + " not possible !" + ;
" try again ?", "Network-error -> &xName !" )
nTrials := nTrcount
IF nTrials > 0
NET_WAIT ( nTrcount, nTrials )
ENDIF
ELSE
lReturn := .F.
EXIT
ENDIF
ENDIF
ENDIF
nTrials --
ENDDO
RETURN lReturn
regards
Uwe