>>Do you think it's safe go this route? Or better use the other idea of instantiating Session object first and creating my object inside it?
>>
>are equal.
>
>>Also when the object will be destroyed, what would be the current datasession?
>
>Current datasession ? Where ? When ?
>
>It doesn't have sense speak of "current datasesssion",
>because VFP have not a "current datasession";
> every object or an active procedure of a .PRG have one "current datasession"
>
>Then, when a stack exist it is:
>
>- PROGRAM(PROGRAM(-1)-1)'s datasession
>
>
>Then, if you write:
>
>* objectX.destroy
>SET DATASESSION TO ....
>
>you change objectX's datasession only!
>and this doesn't set the "current datasession" after "destroy" is finished
Ok, in other words, calling form or program's DS would not be affected without a need to explicitly switch back. I still think Charlie's idea is a bit safer since it's not dealing with SET DATASESSION command, which has a warning in Help. But since I already implemented my idea, it may be too late.
If it's not broken, fix it until it is.
My Blog