Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to create a separate datenvironment by code ?
Message
From
25/06/2006 12:16:08
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01131523
Message ID:
01131533
Views:
13
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform