inside my database, i have three columns, the username, password, and loginattempst column.
Expand|Select|Wrap|Line Numbers
- Dim cmd As New SqlCommand("select * from users where username=@username", conn)
- cmd.Parameters.AddWithValue("@username", TextBox1.Text)
Expand|Select|Wrap|Line Numbers
- 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