>Tell me if I've understood what you mean :
>1) Set Multilocks should be ON
>2) When the user logs in with UserId and Password I try to lock his/her record.
>3) If the lock is successful then the user isn't already logged. If not, the user is already looged or someone else is trying to us the same account.
>4) When the user closes the app the lock is removed.
>
>Right ? If so, it sounds very easy and good. But suppose that the App crashes for whatever reason :( The lock wouldn't be released, and the user should be forced to reset the machine...
That's the idea. I'm not sure what happens if the application crashes. It may depend on the network OS you're using. I gues there's only one way to find out...
>
>>
>>In SQL Server I use the the procs system table to see what processes are running on the server.
>
>How could it be done programmatically ?
What I do is first allow the user to log in to SQL Server. Then I do a SELECT that joins the procs table and the syslogins table (both in the master database). In the where clause I look only for processes where the login name is the name of the user who is currently running the application. If I find more than one instance I know that the user is logged in multiple times and I boot the user out.