Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deteremine how many datasessios are open
Message
From
08/06/1999 11:21:15
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, United Kingdom
 
 
To
08/06/1999 02:40:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00227341
Message ID:
00227456
Views:
22
>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
Regards
Mark

Microsoft VFP MCP
Menulib - OO Menus for VFP www.hidb.com/menulib
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform