Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find open DataSession
Message
 
 
To
21/08/2000 15:03:29
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00407463
Message ID:
00407535
Views:
24
>>Being in a prg (projects's main.prg). Is there a way to check if there is DataSession still open and which one it is, ie. which number (other the datasession #1).
>
>You can try something like:
>
>
on error lnDS = lnDS - 1
>lnDS = MAX
>for x = 1 to MAX
>	lcSetDS = "set datasession to " + str(x)
>	&lcSetDS
>endfor
>?lnDS
>Though, its not very efficent. Consdier storing and restoring the error handler too.

I would simplify this program like this:
private Halt
m.halt=.f.
local lcOldError, lcOldEsc, lcOldOnEsc, lnMax, i
lcOldError=on('error')
lcOldEsc=set('escape')
lcOldOnEsc=on('escape')
on error m.halt=.t.
set escape on
on escape m.halt=.t.
lnMax=10 && Reasonable number of DS
for i=1 to lnMax
   if m.halt
    wait window transform(i-1)+" last DS" 
     exit
   endif 
   set datasession to (i)
next
* Restore original settings
  on error &lcOldError
  on escape &lcOldOnEsc
  set escape &lcOldEsc
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform