>I was thinking to use different DataSessions in my Appllication.
>Actually I'm developing an extension of a Program which was not made by myself. I can launch my app from a menu inside the main Program, so, when I start my App i have tables opened in some areas and the environment set by the main App. I was hinking that it would be nice if I could run my App in a private datasession so that i should not care about cloing tables and so on.
>My App start with a main program which set the environment and finally run a form which calls other forms by clicking different commandbutton. What can I do ?
>
>Alessio
Hi Alessio,
Have look at Session class (Introduced in VFP6/SP3)
It creates it's own datasession where u r free to open any data, run forms, do data processing run reports etc
This will not do any 'harm' to already open tables selected aliases record pointers etc...
When u release session object, all tables openened within are atomatically closed.
But this is not visual class, it is done in code!
Typical implementation goes like this
define class mydatasession as session
procedure init
this.open_data()
procedure open_data
procedure do_my_thing
procedure run_form
procedure run_report
enddefine
After you have something like this in one of your public prgs
you can call it from anywhere by creating object based on this class
local oMySess
oMySess=createobject('mydatasession')
oMySess.do_my_thing()
It is in my opininon very flexible and practical concept,
and I use it for almost everything I do.
See manual for more deails about it.
Rgds++