Click here to Skip to main content
16,019,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
If pos = "MEC" Then

                Session.Add("user", txt_L_Username.Text)

                Dim objT As New transactions

                objT._username = Session("user")

                objT._logintime = TimeOfDay.TimeOfDay.ToString
                objT._dayoftransaction = Date.Today
                objT.record_user(objT)

                Response.Redirect("Emis_Admin_create.aspx")

                Exit Sub
Posted
Comments
Simon Bang Terkildsen 6-Sep-11 12:23pm    
...
zamani2 6-Sep-11 14:38pm    
i want to be able to check which user logged in to the system and at what time... i want to store that time to a sql database, and my problem is it does not return the time to me
Sander Rossel 6-Sep-11 13:45pm    
Please ask a clear question in the body of your post, not just the subject.
Also, where do you want to log to (SQL database?)? How do you want to log (use a logging framework?, to a specific DB table?)? What problem are you facing specifically?
You need to give more information if you want any help...
zamani2 6-Sep-11 14:38pm    
i want to be able to check which user logged in to the system and at what time... i want to store that time to a sql database,
and my problem is it does not return the time to me

1 solution

At the moment of authentication performed at server side, get current time using System.DateTime.Now or System.DateTime.UtcNow. The UTC version of this method is good if you support different time zones. Associate this time with each user which is known to this part of code at the moment of authentication. It's not clear why do you use Date when you need time (which includes date). Convert the structure System.DateTime to database DATETIME and store it in your database.

—SA
 
Share this answer
 
v2
Comments
[no name] 7-Sep-11 0:44am    
good answer. My 5!
Sergey Alexandrovich Kryukov 7-Sep-11 1:13am    
Thank you, Maulik.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900