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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shared Database

Status
Not open for further replies.

ericxbenoit

Programmer
Nov 4, 2001
5
0
0
CA
Hi,

I use Visual Foxpro 6.0 and..

What I want to do is.. when someone login the software, I add his name in a table and when someone else want to do a critical operation, I go see in the table if there is someone logged in (except the person who want to do the critical operation). If yes, I refused the operation.

But the problem is.. User1 login and after that User2 login. So User2 see in the table the User1 name but the User1 doesn't see the name of User2 in the table even if the User2 is loggedin. WHY??

By the way, is there a way to know if a database is open by another EXE application?? Fox example, can myEXE1.exe know if myEXE2.exe uses a common table?

Thanks a lot!

Eric
 
User1 doesn't see the name of User2
Are you refreshing whatever is displaying the users? Like using a requery or flush or tableupdate for instance.

way to know if a database is open by another EXE
There are a few different ways of doing this. One would be to keep track of what tables are opened, similar to your user login method. Another is to check the availability of the file:
Code:
ON ERROR WAIT WINDOW "Table is in use" TIMEOUT 2
USE SomeTable EXCLUSIVE
ON ERROR

-or-

nHandle = FOPEN("SomeTable.dbf", 2)
IF nHandle < 0
   WAIT WINDOW &quot;Table is in use&quot; TIMEOUT 2
ENDIF
=FCLOSE(nHandle)
Dave S.
[cheers]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top