Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Private Data Sessions -- What are they good for
Message
From
08/12/1999 08:46:18
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00300134
Message ID:
00300262
Views:
30
>While this message is addressed to Erik Moore, it really intended for all who have responded to my question on Private DataSessions. First I wish to thank all who have responded. I think the responses have helped. If nothing else the responses indicate the DS are powerful tools and I am about to move into deeper water(?) in VFP. I would like to summaraize what I think I have picked up from the responses and various help files. Please feel free to point out glaring misconceptions.
>
>1. When a form is specified to have a private datasession, the private DS is created when the form loads. Foxpro creates a unique ID for the data session.
>

Right on.

>2. Any data manipulation occurring within the form is acting on the Private DS. The default session and any other private sessions are unaffected.
>

Amen.

>3. If for some reason I wish to have a method or procedure manipulate data in a private session, I must pass the Session ID and the set data session to the id and then perform the necessary funtions and reset the data session back to the default.

Straight up. Buuuuut, this is not a habit you should get into. Usually tasks for data in a datasession should be handled by objects in that datasession. If you find the need to do something like this, have a hard look at your design to see if you went wrong somewhere. (There is at least one good exception to this rule, and that it routines that are designed to loop through all open datasessions and perform some task). I remember an MS source saying one time that SET DATASESSION was never really meant to be a programming tool, but more of a debugging tool.

>
>QUESTION: If I establish a Private DS, what happens if I issue a USE or SQL Select inside the form? Are the tables opened in these commands brought into the Datasession? Or is the Data session limited to the Data Environment?

THe new table is opened in the DS that issued the USE, and will be automatically closed when the form is closed (if Form.DataEnvironment.Autoclose tables in .T., the default).
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform