Link to home
Start Free TrialLog in
Avatar of phantomcom
phantomcomFlag for United States of America

asked on

Problem changing to Private Data session

Using a program in a multi-user environment and having some problems with the tables from time to time. I figured it was because i was using default data session on my forms and from what i have been reading, i should change that to Private data session. When i do that, all of a sudden when running the program and opening the main form, immediately a window pops up where i need to select the table to use.  It appears that the form doesn't know which table to use.

What else do i need to change in the form after i have changed to Private Data session in order to make it work.
ASKER CERTIFIED SOLUTION
Avatar of Cyril Joudieh
Cyril Joudieh
Flag of Lebanon image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
When you switch to the Private data session then you have totally new environment where no table is open and all settings are at their default value (e.g. SET TALK is ON). Thus e.g. Data dictionary or a database open in Default data session isn't visible in Private data session and you have to open it again.

In addition to above and expected "surprise" you have to be aware of some VFP features, like Private Data session set in a form class does not change the form's Data session properly and you have to modify all forms derived from such class in IDE to update the Data session setting...

I am sure all problems can be solved after one day of debugging.
Avatar of phantomcom

ASKER

I've probably set-up my environment incorrectly because of the intermittent problems that arise when using my program. On one computer is the main program..i obviously call it the server. On the other computers on the network, i actually installed VFP 9.0 on each one. Then on those network computers i simply made a shortcut to the exe file in the programs directory on the server.  (i tried to install just the runtime files, but that didn't work and i figured i didn't understand how that was supposed to work anyway).

The problems that occur every once in a while seem to be when there are 2, 3 or 4 users accessing the program.  There is one main screen that is read only, unless you need to edit the record information, then i switch the read only off.  The data on the screen is live, it is not a cursor, which i thought could be a problem but since most of the time the user is just looking at the record and not appending it or just toggling up and down the records (by date) that having the live data on the screen was ok.  I need to check to see if i switched to exclusive use when i allow the editing, because i suppose that could cause problems.

For the most part the program works fine. The setting of default data session was fine. Usually if the program seems to go crazy the user justs exits the program and restarts and all is fine. In about 3 years worth of using the program, some of the tables have become corrupted about 3 times total. It's not like it is happening every day, but it did just happen this week and that's what made me decide to try to fix this situation.  I guess my real question.....is this the correct way to handle a client-servicer or multi-user situation?   Everything i've done to this point has been self-taught ( with plenty of help from Experts - Exchange) and i know i have a lot more to learn.

So the original question was about the Private Data session but now it sounds rather different - VFP installation, data corruption, exclusive use, ... I really don't know what to answer first. We should solve the Private Data session first and then you may continue to ask additional questions about other problems.

So shortly: VFP installation is not necessary on every machine. BTW, did you buy license for each machine? Just look what files are necessary for VFP 9 application run (e.g. here: http://fox.wikis.com/wc.dll?Wiki~VFP9RuntimeFiles~VFP) and the application must work even when you simply copy above files into one folder on the workstation.

Do not open files exclusively in network environment. Use all files in shared mode and lock records which are in edit mode (or lock the record just before saving). Options are described in help or in many web articles, e.g. http://weblogs.foxite.com/andykramek/archive/2005/10/18/948.aspx

And my question: How did you solve the Private Data session?
Yes. original question was about Private data session, but reading what the captain wrote, it sounded like it would not necessary....but i still need to solve the potential corruption issue. So i have not changed to private data session.

Is it ok how i have the network machines accessing the program?

I do need to check the program to see if i am locking the records in the edit mode. I don't think i did.  I'm still thinking that if one user is looking at a form and another user is also looking at the same form and decides to edit the records on the form  then a problem will occur if i try to lock at that point.  Is that correct?

OK, we could solve the data corruption in this question...

but you did not describe the corruption sufficiently. It can happen when users switch off the computer during some operation, it can happen when the OS crashes, or when the network connection is interrupted. What was saved in your DBFs if you qualify them as corrupted?

Better will be if you close this question and select Captain's comment as an answer. And then you may ask a new question about whatever else as EE rules require.

Mixing topics is confusing both for search engines and also for developers looking for certain answer in the future.
I guess you should keep the default session and worry about locking records when editing them and also worry about backing the data up in case there is corruption.