Using a table with a program in multi uses environment

Posted on 2011-10-17
Last Modified: 2012-05-12
I need to record my applications errors in a free table file.
When i start the main program I start my on error() routine, within it I use a table in order to record my applications errors.
The first user runs fine when the second starts using the application he gets an error " file is in use".
is there something i could do?
Question by:luciliacoelho
    LVL 27

    Accepted Solution

    When you record an error on a network you need to have the file shared in access mode. So maybe you are opening the file before SET EXCLUSIVE OFF. What you need to do is this: USE ERROR SHARED.
    LVL 29

    Expert Comment

    by:Olaf Doschke
    Cyril most likely is right. Also consider even if you do SET EXCLUSIVE OFF, this setting needs to be redone for every new datasession, it's NOT a general setting.

    There's a slight chance for something else: Even if you use your error dbf shared, an error "file is in use by another user" can occur, so the question is, do you have error 3 or 108? Report the error number additional to the error message to see what exact error you have. The difference is, you'll also get this with shared use, if a write locks the header for a moment. If you do transactions that could even last longer than you want, if you forget to end it. Close the dbf after writing the error in it, close/rollback all tranactions even before opening it. Also the initial error leading to the error handling could be during a transaction.

    Bye, Olaf.
    LVL 41

    Assisted Solution

    I also recommend to open/close error file when an error occurs, I just don't agree with SET EXCLUSIVE OFF necessity.

    SET EXCLUSIVE OFF is default for private data sessions but the best practice is to place the EXCLUSIVE/SHARED keyword into each USE command as Captain recommended.

    Your error points to the locked file header. If you SET TABLEVALIDATE TO 0 before opening then the error should disappear BUT it does not ensure the new error writability because of the pending lock.

    If the error occurs during a transaction then you should just ensure the error.DBF is a free table which also means "outside" the transaction obviously.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: (http://msd…
    The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now