Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Understanding public object and Data Session
Message
From
24/05/2008 11:35:33
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01319198
Message ID:
01319357
Views:
19
>>http://fox.wikis.com/wc.dll?Wiki~DataSession
>
>Thank you, Frank.

rule e) of that wiki article is your way out normally.

Eg you have some application object goApp which is started in the public/general datasession 1.
It offers seom method creating a cursor you may need in several places, eg a list of users. You'd need this cursor to be created in the private datasesson you call from, then add a method setDatasession to your
App class, simply:
LPARAMETERS tnSession
SET DATASESSION TO tnSession
In the calling session do goApp.setdatasession(SET('DATASESSION')) before making the call creating a cursor and you're done.

You may also want a resetdatasession() method, which resets an object to the datasession it was created, then simply store SET('DATASESSION') to some property in the init() event.

Be cautious, I'd never change a form's session, that causes problems with bound controls, I'd just recommend that for classes tht act as some kind of library of methods you need in many places.

You could also make use of functions, that always work in the same datasession as their caller.

Bye, Olaf.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform