Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Protected Sub btnSubmit_Click(sender As Object, e As System.EventArgs) Handles btnSubmit.Click
- If Page.IsValid Then
- ' check for username & password in the database
- Dim conn As New SqlConnection("Data Source=.sqlexpress;Initial Catalog=LoginDB;Integrated Security=True")
- ' Get the row corresponding the given username and password
- Dim strSQL As String = "Select * From Users Where Username='" + txtUname.Text + "' and Password = '" + txtPassword.Text + "'"
- Dim dsc As New SqlClient.SqlCommand(strSQL, conn)
- ' Fill the dataset
- Dim ds As New DataSet()
- dsc.sqlclient.sqlcommand(ds, "Users")
- ' if there no entry then the user is invalid
- If ds.Tables("Users").Rows.Count = 0 Then
- Response.Redirect("Default.aspx")
- Else
- Response.Redirect("login.aspx")
- End If
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement