Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Disallow multiple logins by one user
Message
From
06/09/2006 11:35:59
 
 
To
06/09/2006 08:44:10
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP1
Database:
MS SQL Server
Miscellaneous
Thread ID:
01151271
Message ID:
01151369
Views:
22
>Hi,
>
>I want to be able to lock a user out once they are already logged in to my application. I currently do this using a DBF file in which I lock a record (RLOCK()) when the user logs in. The RLOCK() automatically gets released when the user shuts down the app either by logging out of if there was a crash or the user terminated the app or switched off the PC.
>
>Is there a way to do this using an SQL Server database? I am trying to avoid having to create another shared folder to put just this one DBF in.
>
>Thanks,
>
>Frank

when the application start:
* sync mode
h=SQLCONNECT(...)
SQLEXEC(m.h,"EXEC sp_who","who")
* BROWSE
COUNT FOR loginame=="userloginname"
* USE
IF _TALLY>1
   SQLDISCONNECT(m.h)
   QUIT
ENDIF
OR
<pre>
* sync mode
h=SQLCONNECT(...)
IF SQLEXEC(m.h,"SELECT @@SPID spid;EXEC sp_who '"+"userloginname"+"'","spid")=2
   LOCATE FOR spid<>who.spid
   * USE who,who2
   IF NOT FOUND()
      * CONTINUE
   ENDIF
ENDIF
SQLDISCONNECT(m.h)
QUIT
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform