Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why can't I change DataSession in a class
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00666133
Message ID:
00666270
Views:
15
>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?

You're thinking about it the wrong way. When you create a Session object, only operations done from the object are in that session. However, in the first listing, you could do SET DATASESSION TO lo.DataSessionID, and it should work (as long as you save and restore your current datasession). In the class definition, I wouldn't change the datasession at all.

MSKB#Q248116 has more details about using the session class.
My blog
My consulting page
My home page

Member of the Trim Your Auto-Quote Campaign!
What's another word for thesaurus?
Previous
Reply
Map
View

Click here to load this message in the networking platform