Deleting Entry From LOGGEDINUSER TABLE
-
Saturday, April 28, 2012 12:03 PMI need to delete an entry from the LOGGEDINUSER TABLE whenever the user logs out, using the dedicated log out button i can accomplish this easily,
My question is when the user closes the browser without clicking log out button how can i delete the entry from the LOGGEDINUSER TABLE ???.
I need to do this in chat application where real information about currently logged in users is paramount.
All Replies
-
Sunday, April 29, 2012 1:51 AMModerator
hi,
this can not be done in SQL Server.... it is not aware of a remote (or even local) application shut down.. so, unfortunately, that is not directly related to SQL Server\SQLExpress, but to direct develpment/application code... should I move your question to a development forum?
regards
http://www.asql.biz - DbaMgr2k - DbaMgr and further SQL Tools http://www.hotelsole.com/
-
Sunday, April 29, 2012 3:06 PMModerator
Hello,
I suppose that the browser has an event of its close like in the Windows Forms, you have the event FormClosing , you create an handler for this event. You check whether the current user has logged out ( the best way would be to use a static in VC#,Shared in VB variable with true if the current user is logged, false if he has logged out ). If this variable is true, you delete the entry from the table , if false, you do nothing. Another way would be to check in this event whether there is a row in your table corresponding to the current logged user , if there is a row , you delete it else you do nothing.
You can create a stored procedure which could do that .But
1) it is related to the creation of a stored procedure. A moderator can move ( with your agreement ) your thread towards the good forum. But only after having given the full definition of your LOGGEDINUSER table, with columns,keys... ( on the new forum, potential repliers will begin to ask you these informations )
2) for the use of this stored procedure, it would be useful to tell us the language and needed references ( Windows Forms, ASP.Net) needed by your chat application.So we will be able (maybe) to tell you on which forum you should post to use the stored procedure in your application.
3) You have not told us which kind of DBMS ( SQL Server,Access,MySQL,ORACLE,...) you are using
We are waiting for your feeback to try to help you more efficiently ( only one thing is sure : your thread has nothing to do with this forum , except if you are using SQL Server Express ( but which version 2005,2008,2008 R2,2012 ?
Have a nice day
Mark Post as helpful if it provides any help.Otherwise,leave it as it is.
-
Friday, May 04, 2012 11:43 AM
hi please refer this forum for your reference, it may help you.
http://forums.asp.net/t/1799095.aspx/1?Deleting+Entry+From+LOGGEDINUSER+TABLE

