Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update tables on network

Status
Not open for further replies.

bpratl

Programmer
Jul 7, 2002
25
US
Hi,
We have a small network,with 4 workstations,using a POS system with VFP 9.0. The problem is at closing and doing the nightly reports and updates everything goes well providing all workstations are log off VFP. If any stations are left on the progran crashes and files are not updated. ECCLUSIVE is ON and MULTILOCKS are OFF. What is the best way to detect and identify a workstation that is left on or a better way to not allow sharing when doing a report? Thanks.
Bob
 
Bob,

The first think to ask is if you really need to have EXCLUSIVE set to ON. It's likely that this is causing the "crash" (not really a crash; VFP is simply trying to open a table that another user already has open).

If your close-down routine is simply printing reports or updating an end-of-day control table, you can probably get away with leaving EXCLUSIVE set to OFF, and that should solve the problem.

If you really do need exclusive use, you can detect the fact that other users have the table open like this:

Code:
lnError = 0
TRY
  USE TheTable
CATCH TO loError
  lnError = loError.ErrorNo
ENDTRY
IF lnError = 1705
  * Cannot get exclusive use
ELSE
  * Continue normally
ENDIF

If you can't get exclusive use, you will need a way to force users to log off. VFP doesn't have a native way of doing that, but it is fairly easy to write some code to do it.

I have an article in the current issue of Foxpro Advisor which shows a class you can use to cleanly force users out of the system. It is designed for exactly the situation you are in.

If you don't have the magazine, you can write a similar class or function yourself. Essentially it involves an administrator writing a text file to a specified shared directory. Each user's instance of the application includes a timer which periodically checks for the presence of that file. If the file is detected, the application issues a warning message to the user, giving them a chance to save their work. At the end of the warning period, the applicatinon closes down.

I hope this helps.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi,

Look into this FAQ.. thogh not a straight answer, it can help you force users out, in case you need to do so.

A way to force Users out of your VFP application.
faq184-3152

:)

____________________________________________
ramani - (Subramanian.G) :)
 
Hi,
Thanks for all that replayed. I will take your sugestions and post results.
Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top