I cannot use dbzap because it want exclusive mode
is there another solution ?
I'm thinking to use this function but it not run and crash the procedure
- Code: Select all Expand view
- Function allRecordErase(cAlias)
local nRecord := (cAlias)->(Recno())
local nNext
Do While .not. (cAlias)->(eof())
(cAlias)->(DbSkip())
nNext := (cAlias)->(Recno())
(cAlias)->(DbGoto(nRecord))
IF!Occupato((cAlias))
(cAlias)->(DbDelete())
(cAlias)->(DbCommit())
(cAlias)->(DbUnlock())
ENDIF
(cAlias)->(DbGoto(nNext))
if (cAlias)->(EOF()) .or. nNext == nRecord
(cAlias)->(DbGoBottom())
endif
(cAlias)->(dbSkip())
Enddo
return nil
Occupato function
- Code: Select all Expand view
- FUNCTION Occupato(cAlias)
LOCAL lRet:=.F., nTimes:=5
DEFAULT cAlias:=Alias()
DO WHILE nTimes>0
IF (cAlias)->(RLock())
nTimes:=0
ELSE
INKEY(0.5)
nTimes:=nTimes-0.5
IF nTimes<=0 .AND.;
MsgYesNo("!Record occupato da un altro utente!, ¿Continuare?","Conferma...")
nTimes:=3
ELSE
lRet:=.T.
ENDIF
ENDIF
ENDDO
RETURN (lRet)
any solution please ?