Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dare I use the default data session?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00353286
Message ID:
00353531
Views:
18
I use local views. The help for USE sort of implies that the NOREQUERY clause is for remote views. However, I'm not sure how I would use that in my forms, which use ordinary DataEnvironments. I set the DataEnvironment.AutoOpenTables to .F. for each form. My form class calls an object from the .Load which receives the form as a parameter and points the oForm.DataEnvironment.Database property to the home folder (the usual removal of the hard-coded path) and calls .OpenTables(). How do I point my dataenvironment to the other form's datasession?

The help says "Avoid changing the DataSessionID of a form instance because data-bound controls lose their data sources when you change the DataSessionID." It doesn't say what would happen if I did it before calling the datasession.OpenTables(). Since the object method that has that code is called from the form.Load, the .Init of my bound controls hasn't happened yet. Should I try that? If no one else does it that way, there's probably a good reason, unless I'm smarter than everyone else.

I was once warned that when a form using the default datasession closes, it may stomp the tables in the datasession. My problem is probably different, because my forms haven't closed. Are these the reasons why you don't use default datasessions, or is there something else wrong with them?

>I almost always prefer private DS. See the VFP help on USE with the NOREQUERY nDataSession clause. That may help with the speed of opening the form with a private DS.
>
>>I have forms that have a big grid. Clicking on the grid opens up a detail form displaying the same cursor, hopefully at the record that was clicked in the grid. (I pass the key value as a parameter and LOCATE FOR that value in the detail form.) I had one pair of forms where I had to give the detail form a private data session to make it work. Mysteriously it worked for the other form pairs. The problem refuses to appear in the debugger. I now have another form pair that just started doing something similarly wrong, after I changed the cursors somewhat. The detail form opens to the right record, but as soon as I click a nav button, it goes to the first record. It works correctly in the debugger (naturally). Changing the form to private datasession made it work correctly. However, that makes the form take longer to open, because the cursor is a view that takes a little while to join. Now I have that overhead for both the grid and the detail form. When the detail forms open,
>>it .HIDEs the grid form without closing it, so the data session ought to be all right.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform