Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 19750 |  Welcome, Guest!   Register  Login
 Home > Forums > Sql Server > how to insert login and logout times ...
Vineeth1311

how to insert login and logout times

Replies: 4 | Posted by: Vineeth1311 on 6/10/2009 | Category: Sql Server Forums | Views: 1678 | Status: [Member]  


hi

how to insert logout time in to sql server +when i close the browser?


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Vuyiswamb
Vuyiswamb  
Posted on: 6/11/2009 8:01:35 AM
Level: NotApplicable | Status: [Member] [MVP] [Administrator]

Good Afternoon Vineeth1311

The Simple thing you can do is to Insert a new record when the user logs into and when he logout Update the Field of datetime and set it to getdate() , which is the current time.

1 insert statement and 1 Update statement when the user logs out.

Thank you for posting at DotnetFunda

Vuyiswa Maseko


Thank you for posting at Dotnetfunda
[Administrator]

Vineeth1311, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Vineeth1311
Vineeth1311  
Posted on: 6/11/2009 10:07:58 PM
Level: Starter | Status: [Member]

And also I want to insert the time when user closes the browser

Vineeth1311, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Vuyiswamb
Vuyiswamb  
Posted on: 6/11/2009 11:40:20 PM
Level: NotApplicable | Status: [Member] [MVP] [Administrator]

Good Morning Vineeth1311

yes lets say i have a Table called timelogging defined like this

Create table timelogging 

(
ID int identity(100,01) Primary key not null ,
Username varchar(20) null,
LoginTime DateTime null,
LogoutTime DateTime null
)


in this Case when the User logs in you will insert a new Record and like this

insert into timelogging (Username,LoginTime)
values (@Username,GetDate())


and when the user Closes the Application by logging out , now you don't insert a new record but you Update a Field "LogoutTime like this


Update timelogging
set LogoutTime =Getdate()
where Username = @Username


Thank you Again For Posting at Dotnetfunda


Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Vineeth1311, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Bubbly
Bubbly  
Posted on: 10/23/2009 10:21:04 AM
Level: Bronze | Status: [Member]

Hello,

You can update the time on close event of window.

++
Thanks & Regards,
Deepika

Vineeth1311, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

Found interesting? Add this to:


 Latest Posts

Write New Post | More ...

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/19/2013 9:11:59 PM