Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Private DataSession Won't Close Out?!?
Message
From
18/10/2002 13:07:49
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00711562
Message ID:
00712964
Views:
20
>Hi,
>
>>>
>I've not seen it happen in all circumstances, but I have seen strange things occur when you change the datasession manually and don't put it back where you found it.
><<
>
>So you're referring to cases where code which is expecting a specific datasession is executing with a different one set ? I'd certainly expect problems in that scenario - however (begging the question of why anyone would do it <s>) I've not seen problems when releasing a form when it's datasession is changed after it has been instantiated.
>
>Guess all I'm really trying to pin down is how an 'Unknown' datasession comes about.
>
>Regards,
>Viv

let me try to answer you Viv.

Frequently I call a method from a custom 'application' type of object from within a form that has a private data session. Since this custom application object was created in the default data session as soon as the code in that method begins firing it seems to automatically go to the default datasession. But then, when the custom application object's method ends firing and control goes back to the form it seems to automatically switch back to the datasession of the form. This is not a factor in my problem because this situation occurs whether I fire that application object's method or not. But I've developed the view that after you call such an application object's method from wtihin a form and that method goes to the default data session. then in the line of code after firing it I should manually switch back to the datasession I want with 'SET DATASESSION TO lnDataSessionID'. Even though this is normally not necessary because it normally comes back automatically.

I call such a method to figure out things that commonly need to be figured out in various different forms through the course of numbers crunching and info processing.

But as to exactly why this 'Unknown' datasession is left behind when the form goes down is still a bit of mystery to me. If an object is created in that datasession and then not released, then this would do it according to info we've found on this thread. I don't see how that could be causing the problem though because I'm not adding any objects while the form is up. The only object is the form and objects contained in the form, and that goes down without a problem.

I did find that 1 of the 2 DBC's that I have in the application behaves
differently after this problem occurs. When I ran a maintenance procedure after this form goes down and the 'Unknown' datasession is there, then 1 of the 2 DBC's simply won't close which is something that occurs in the maintenance method. I worked around that by issueing CLOSE DATA command in each of 12 datasessions. Of course, I just picked 12 because I figure there won't be a time when user will create more than 12 datasessions. I just cycle through data sessions ... ... SET DATASESSION TO 2, then 3, then 4, etc. and in each one CLOSE DATA. The 'Unknown' datasession goes away when I do this and everything works normal. So, I've worked around the original problem, but I still don't know exactly what causes it.

Wally Noll
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform