Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get the datasession from AUSED()?
Message
From
05/08/1999 15:35:07
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00250315
Message ID:
00250352
Views:
10
>In my error handling program, I would like to revert all the tables opened in the system. I use AUSED() to create an array of the opened tables. However, it gives me the tables without telling me in wich datesessionID it is so when I do a select on the tables, it doesn't recognize them? Any way to get the datasessionId for an opened table?
>

AUSED() is scoped to the current data session if no data session is specified in the second parameter of the function call. If you need to close the tables of all data sessions, you need to iterate through the data sessions and examine and close them separately.

AUSED will be upset if you specify an invalid data session id, the approach I'd take would be to iuterate through the _SCREEN.Forms collection, get the datasession, and do the AUSED, something like:
LOCAL i, oForm, aAliases[1,2], nAlias
IF _SCREEN.FormCount > 0
   FOR EACH oForm IN _SCREEN.Forms
      DECLARE aAliases[1,2]
      aAliases = NULL
      nAlias = AUSED(aAliases,oForm.Datasession)
      *  nAlias has the number of active aliases in the ds, and aAliases is the 2D array
   ENDFOR
ENDIF


>thanks
>eric.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform