Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why can't I change DataSession in a class
Message
From
07/06/2002 15:31:18
Irv Adams
MSC Managed Care, Inc.
Florida, United States
 
 
To
07/06/2002 14:54:18
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00666133
Message ID:
00666145
Views:
18
As far as I can tell, everything you want to do regarding Tables, Datasessions, etc. must be done within the scope of the Session code itself. The 'Set Datasession' issued within the Method overrides the Session class created. The Session is 'beneath' the Method in calling order.

You need to 'wrap' something with a Session Class, meaning let all the work be done within the Session or it will go out of Scope...or, Add the Session to a Container as an object and all items within that container can access it...

-Irv.

>I tried this:
>SomeForm.Method()
>  local lo
>  lo = NewObject('Save_Ds','Save_Ds.prg')
>  Set DataSession to SomeOtherDataSession
>  .... print a report from SomeOtherDataSession
>  release lo
>  .... continue some more in Form.DataSession
>
>Save_DS.prg
>  Define Class Save_Ds as Custom
>    nDS = Set('DataSession')
>    Procedure Destroy()
>      Set DataSession to this.nDs
>    EndProc
>  EndDefine
>
Why doesn't it work?
>In the debugger. As soon as the Save_Ds.Destroy() method starts, the DataSession changes from SomeOtherDataSession to the one I want (making the line "Set DataSession to this.nDs" pointless), but as soon as it goes back to SomeForm.Method() the DataSession changes back to SomeOtherDataSessoin.
Previous
Reply
Map
View

Click here to load this message in the networking platform