Click here to Skip to main content
15,999,861 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I was make a Control For User Login but I need TO record the time when the User logs in and save the time login in the table

Just I need procedure to do this ?
Posted
Updated 2-Sep-11 5:09am
v2

1 solution

Since you tagged your question as VB.Net, I understand that you dont need a T-SQL query to answer your question.

I dont know in which point you had difficulty though;
Your steps as follows;

Create a table with the fields of , ID, UserID, UserName, LoginTime if you need you can link this table with your Users table and use UseriD as a foreign key.

In your login page. Connect to your DB, and make a insert query to the specified table. Something like

Try
        Mycn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=[your db].mdb;")
        Mycn.Open()
        SQLstr = "INSERT INTO Table1 (field1, field2,field3) VALUES('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "')"
        Command = New OleDbCommand(SQLstr, Mycn)
        icount = Command.ExecuteNonQuery
        MessageBox.Show(icount)
    Catch ex As Exception
        MsgBox(ex)
        Mycn.Close()
    End Try
 
Share this answer
 
Comments
salah3bdelfatah 2-Sep-11 16:52pm    
OK This IS Help Full and I do that But ,I want to record The Login Time IN Table While UserName=username(in The Table) and UserPassword=UserPassword(In the table)
Orcun Iyigun 2-Sep-11 21:49pm    
again make a connection to the db, select the username and password fields, retrieve all the usernames and passwords specified to them. Put them into an array, then loop through that array for a username and password match.. if match insert or update the date.
salah3bdelfatah 3-Sep-11 11:40am    
Thank you For Help ,

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