>I made an object that goes and fetches some data. The problem is that the object isn't using my form's datasession, even though it's being called from there. It insists on reverting to the default session. How do I force it to use the form's datasession? A data gathering object does me no good if I can't see the data it gathers. :(
>
>Thanks,
>
Michelle,
I don't know if you got an answer to this so I'll throw in my $0.02.
Objects exist in the datasession where they were created. If you create the "global" data object in the default datasession, then each method call to the object does an implicit SET DATASESSION TO that datasession. When you exit the method, the current datasession is used (in this case, the datasession of the form).
You can pass the datasession of the form to the data gathering method and use SET DATASESSION TO in the actual method. I belive Nadya metioned something about doing this in the Init but you don't have to do it there. If your object is fairly heavy-duty, you don't want multiple copies living aorund if you don't need them.
Jose mentioned that you shouldn't use this because of the disclaimer in the docs. Don't worry about this. If you use it wisely, there are no disturbing side-effects. You can't do this with forms that contain controls because the data bound controls will get screwed up. However, you can do this without any problems with a Custom object.
Note: Make sure to cleanup after yourself. When you change to the form's datasession in the method, save the current datasession and reset it before exiting the method.
HTH.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao