Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void methodConfirmation()
- {
- try
- {
- connection.Open();
- command.Connection = connection;
- string sqlConfirm = "SELECT userName, password FROM tblUser WHERE userName = @username AND password = @password";
- command.CommandText = sqlConfirm;
- command.Parameters.AddWithValue("@username", username);
- command.Parameters.AddWithValue("@password", txtPassword.Text);
- SqlDataReader reader = command.ExecuteReader();
- command.Parameters.Clear();
- if (reader.HasRows)
- {
- connection.Close();
- successful = "true";
- this.Tag = successful;
- this.Close();
- }
- else
- {
- MessageBox.Show("Incorrect password.");
- txtPassword.Focus();
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("Error: " + ex);
- }
- finally
- {
- connection.Close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement