hi, i want to know how to implement this one, im trying to do a login page in vb.net and after 3 consecutive login attempts, the username will be locked and will not be able to login to the system.
inside my database, i have three columns, the username, password, and loginattempst column.
so the above code selects the username from my database, but my problem is how to read the item on the loginattempts column. I heard about data reader but i dont know yet how to use it properly. This is actually code using datareader on my form
inside my database, i have three columns, the username, password, and loginattempst column.
Code:
Dim cmd As New SqlCommand("select * from users where username=@username", conn)
cmd.Parameters.AddWithValue("@username", TextBox1.Text)
Code:
Using conn As New SqlConnection(constring)
Try
conn.Open()
Dim cmd As New SqlCommand("select * from users where username=@username and password=@password", conn)
cmd.Parameters.AddWithValue("@username", TextBox1.Text.ToString)
cmd.Parameters.AddWithValue("@password", TextBox2.Text.ToString)
Dim dr = cmd.ExecuteReader
If dr.HasRows Then
Form2.Show()
Me.Hide()
Else
MessageBox.Show("Put some error messages here")
End If
Catch ex As Exception
'do something here
End Try
Comment