Hi everyone,
I need help for this problem...i want to record the time that the user and administrator login in the system and put the record into the database...how can i do it?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Javeed M ShaikhPosted Oct 10, 2011, 11:07 PM
DateTime dt = DateTime.Now;
string mtime = dt.ToString("T");
you can use the above to get the current time and insert/update the same in your database on the login and logout event.
Please do not forget to mark "Accepted Answer".
Black DiamondPosted Oct 10, 2011, 10:59 PM
I want to control the time login and logout in csharp code...and put into database...
Javeed M ShaikhPosted Oct 10, 2011, 10:47 PM
You have couple of options to do this:
1. Pass the current datetime from the application to the database via SQL or stored procedure, make sure that you do this after successful login
2. In the stored procedure or SQL use the SQL Server GETDATE and record your activity after successful login has been notified.
Please do not forget to mark "Accepted Answer".