General information
Category:
Coding, syntax & commands
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only