hi
i want to Maintain login
and logout time details
for each user and
store those details
into my database...
(each time the user
loggedin)

and when the user Exit the application it store logout time in database
what is the efficient
way to do this..
need ur suggetsions..

u need a table which will have the userid, logintime, logouttime columns...

whenever the user logs into the application save the system date time into the database with userid as the criteria
when the user logs off or directly closes the application then prompt with a yes / no msg whether he wants to log out...
if he selects yes then save the logout time in the database with the same userid as criteria

You also have to consider

  1. Can the user log in on more than one machine at a time.
  2. What happens if the user loses his/her connection without logging out, for example, if the user's machine or application fails or if the machine hosting the application dies.

You can account for #1 by storing the machine name in the table. You can account for #2 by resolving "orphaned" records at log in time (if the user logs in and there is a record for that user with a log in time and no log out time then you have to resolve the missing log out).

any query about this. . . . , . !. ?

i have a query about loging details
Query = "INSERT INTO tbllog (USERID, userNAME, LOGIN) VALUES(' "& TextBOX1.text & " ',' " TextBox2.Text & " ',' " & Now &" ' "

it work fine for Login but when the user Logout how update the tblLOG FOR LogOUT column. . . . e.g
Query= " update tblLOG set Logout=' "& now &" ' where < here what we write to update the curent Login > "
. . . . , . !. ?

Assuming you have only one record for the user that does not contain a log out time, the query would be

query = "UPDATE tbllog SET logout=GETDATE() "    &
        " WHERE userid='" & textbox1.Text & "' " &
        "   AND logout IS NULL"

Put a command to LOGIN and OUT. Table fields --- user_id,user_name,user_pass,datetime_login,datetime_logout.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.