Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Understanding public object and Data Session
Message
De
24/05/2008 11:35:33
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01319198
Message ID:
01319357
Vues:
20
>>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform