Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Private DataSession persists after Form close
Message
From
21/11/1998 07:13:53
 
 
To
20/11/1998 23:58:17
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00160084
Message ID:
00160120
Views:
12
>A Form with a Private DS is instantiated with some Tables opened in Load. Another object is instantiated (noncontained by form) from within :-
>
>PUBLIC oRef
>oRef = CREATEOBJECT()
>
>oRef is here to stay after the form is released. After the Form’s release, we find that the DS is still valid. SET DATASESSION TO (nOldDS), and the tables are still opened with the record pointers intact.
>
>We can then say that objects created by CREATEOBJECT() from within the form that were not released prior to the Form's release, prevents the Form's PrivateDS from closing automatically
>
>I encountered this behavior a couple of months back, and wonder if there’s somethign I overlooked. Would also like to know if this behavior can be observed in VFP6 as well.
>
>TIA

An object of takes on the data session that is current at the time of creation. So the object grabs a handle on "dataenvironment" which does not disappear until the last thing hanging on to it is released.

BTW this makes object procedures fairly tricky, because they only see the one dataenvironment. Personally I like to keep procedures that generically handle data files in a procedure library (the old fashioned way), where they see the current data session, rather than in a object, such as the application object.

HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform