Multiple Logins

  • Hi,

    We were wondering if there was a quick way on the server side to detect and message back to the user if he/she tries to login in on more than one work station. Currently, on logining in the user and workstation are verified in the database to allow access to our application. The issue is that the user can login into many workstations due to that each workstation is not assigned to one user. We want to either message back to the user that they are currently logged into another workstation and/or terminates the last login session on a different workstation and allows the user to login.    

  • Hi John,

    Yes, this is possible!  I have done it myself in a previous company.  There are quick ways.

    1)  On logging in, you could query sysprocesses and see if the user is already logged in

    2)  You could insert the resultset from a sp_who call into a temporary table.

    3)  You could have your own current login table within the database

    Although I have given you the options, I would stay clear of option 1.  I do not recommend querying system tables as part of an application.  Option 2 would do the same as option 1 but by using a safe stored procedure.  This is the method I would choose if creating a login table manually is not an option.  However, given the choice, I'd have a small table which simply has the current users logged into the system.  You could query the table when you log in and if a duplicate login is present, display an error, if not, insert a new row and away you go.  Do remember to delete logins when the application is closed down though!

    That should get you off and running - feel free to ask any other questions!

    Clive

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply