>People ,
>
>Do you have a function where i can determine how many datasessions
>are open
>
>Regards ,
>david
I've needed this in an application cleanup. If it crashes, close up all the outstanding datasessions before exitting VFP.
The only way that I found to do it was to try SET DATASESSION TO for each session, then catching an error if it ocurred.
Something like
FUNCTION SessionCount
LOCAL lcOldError, lnLoop, lnCount
PUBLIC glFlag
lcOldError = ON("ERROR")
lnCount = 0
ON ERROR glFlag = .t.
FOR lnLoop = 1 TO 1000
glFlag = .f.
SET DATASESSION TO (lnLoop)
IF NOT glFlag
lnCount = lnCount + 1
ENDIF
ENDFOR
ON ERROR &lcOldError
RELEASE glFlag
RETURN lnCount