Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I create a private datasession programmatically?
Message
From
17/11/1998 17:04:00
 
 
To
17/11/1998 15:51:53
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00158496
Message ID:
00158521
Views:
16
>I have a FoxPro 2.6 app which I am converting to Visual FoxPro 3.0. At several points in the app, the code is creating a view from the FoxPro environment [using the CREATE VIEW (tempview) command]. The code then closes all databases, opens some tables, creates several cursors, and does various file and data manipulations. When it is done, it closes all the databases and cursors it had opened, sets the view to the stored view [using the SET VIEW TO (tempview) command], which effectively destroys the cursors and restores the FoxPro environment, and erases the .VUE file.
>
>This chunk of code is just SCREAMING for a private data session. If I was doing this in a form, it would be no problem to set the DataSession property to Private. However, this is all running in a .PRG which is called from a Click method in a form. This form also calls several other programs, all of which would need their own data session.
>
>Is there any way to define a private data session through code, select this data session, do whatever needs to be done, then deselect and destroy this private data session? I looked in the Universal Thread Knowledge Base, but could not find a solution.
>
>If it can't be done, I suppose I could continue using the stored environment, but this would be a really neat trick, not to mention incredibly useful in other programs.
>
>Bill Yater

Why no just createobj a form, set its datasession to private... just keep the form invisible until you are done with the datasession. Then, all you ahve to do is close the form, and the datasessions goes away... along with any tables and cursors opened in it.

BOb

BTW: You could even create a little utilty that just created datasessions for you, but instantiating a form with a private datasessions, and returning the name to you.
Previous
Reply
Map
View

Click here to load this message in the networking platform