Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to create a separate datenvironment by code ?
Message
De
25/06/2006 12:16:08
Chris Bohling
Myers and Stauffer LC
Shawnee, Kansas, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01131523
Message ID:
01131533
Vues:
14
>I have a oSession class that I call from different forms. In this class, I have a method that I would like to run in a separate datenvironment (not in the default one). Basically I would like to make sure whatever I do in the tables would be cleared once the class has been run.

This is an example of how to set up the Session class:
DEFINE CLASS MyCustomSession AS SESSION

   DATASESSION = 2  && private data session = VFP default
	
   PROCEDURE Init()
      This.OpenTables()  && Just an example of how tables might be opened
   ENDPROC
	
   PROCEDURE OpenTables()
      * Example of a method that would open tables
   ENDPROC
	
   PROCEDURE MyMethod()
      * Do something with tables
      * opened in this private data session
   ENDPROC

   PROCEDURE DESTROY
      * Tables opened in this private data session will be closed
   ENDPROC

ENDDEFINE

* Use the session object
oSession = NEWOBJECT("MyCustomSession", <location>, etc.)
oSession.MyMethod()
oSession = .NULL.
Christopher Bohling, Consultant
http://www.ChristopherBohling.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform