>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.