Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The Session object and Grids
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01380409
Message ID:
01380412
Views:
60
Unfortunately, there is no simple workaround for this problem. The Help warns you against using SET DATASESSION command in run-time. You can not switch DS for the form.

You can add a new object based on session to your form, though. In this case the grid is not going to be affected.

>Is there any way to use the session object harmoniously with grids? I wrote a control that's based on a container. It creates a Session object and opens all it's data inside the session. Within any of the controls methods that needs access to the controls data I switch the DataSession to point to the controls Session, do whatever I need to do, and then reset the datasession to the default. The reason this is important is that there may be any number of these controls on a form and they all need to have a private copy of the data.
>
>This works great, but... When I put the control on a form that contains a grid, every time I switch the datasession within my control the grid looses its RecordSource. This is understandable since the grids RecordSource is going out of scope, but, it's a real dissapointment because it makes the session object, at least for my purposes, useless. I can't believe that there isn't a way around this problem... How do you give a user defined VFP control it's own DataSession without perturbing the other controls in your system?
>
>It seems so simple. There should be a way to reference your data based on the datasession the cursor resides in. Something like:
>
>oDataSession1.MyTable.TableField1
>
>Any ideas?
>
>Thanks,
>
>Steve
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform