Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Datasessions
Message
From
11/10/2001 07:54:51
 
 
To
11/10/2001 05:26:55
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00566833
Message ID:
00566862
Views:
9
Hi!

Any time VFP enter to the object's method code to run it, data session is automatically switched to the data session ID that was current at the moment when that object created. So in your case you probably need to change a solution, otherwise you will require to call SET DATASESSION command in each method of your object.

Another solution is to do another sequense of objects creating:
application object creates session object that recive in the Init event parameter - third object to create and return reference to that third object. Session object - is just your custom session object class that does nothing but create object using passed parameters in the Init event. (As far as I know, you can destroy the session object after that - data session will be kept in memory until all objects that use it are destroyed.)

Note that you cannot add object to form and use another data session for that object. This is a rule for objects containerships in VFP - child object uses a data session of its parent object. When you create a free object and just reference it by property of another object - it is ok. That is why in solution I mentioned that you can return a reference to new object from the session object.

HTH.

>Hi
>
>I have an application object that creates another object, that creates a SESSION Object.
>
>In the 2nd Object I want it to change to a Private datasession through the Session Object. I'm using
>
>
SET DATASESSION TO this.oDataSession.DataSessionId
>
>But the DatasessionId is 1, shouldn't it be 2? Can anyone shed any light on this ? VFP6 SP3.
>
>Thanks
>Kev
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform