Hi Mark,
>>>The problem is the oMethod object exists in the default datasession. What I do is pass the DataSessionID to my oMethod.SetFunctions(). In the SetFunctions method, I set the DataSession to the ID passed to it.
>>
>>Hmm that's a good idea. But we created objects based upon the CustomClass object. Would it be better to create such an object based upon a formobject? Because the customclass object doesn't have a dataenviroment.
>
>Does not matter. My app class is based on custom as well. It does not have to be a form to switch datasession IDs.
At the moment we did the following: We created a method in our oMethod object. This is called InitSet(). In this procedure we have all our usual SET commands. We then call this routine in the BeforeOpenTables event of our dataenviroment of our PrivateDataSession form like this: oMethod.InitSet(THISFORM.DATASESSIONID). At the beginning of our InitSet() method we have the following:
LPARAMETER mDataSessionID
SET DATASESSION TO mDataSessionID
What about this? Is this the right way to do it? I read the SET DATASESSION help and it said it will switch to the datasession you specified. How do you get back to a GlobalData session (or other datasession which are used)?? Or does VFP return to the global datasession when the form is closed?
Thanks for your time!