Untitled


SUBMITTED BY: antoineh1

DATE: May 5, 2016, 12:41 p.m.

FORMAT: Text only

SIZE: 1.5 kB

HITS: 654

  1. SqlConnection cnn = null;
  2. SqlCommand cmd = null;
  3. SqlDataAdapter sda = null;
  4. DataTable Dt = new DataTable();
  5. cnn = new SqlConnection("Server=dbadmin01.database.windows.net;Database=dbadmin;User=info;Password=notGivingThis");
  6. cmd = new SqlCommand("SELECT username FROM users WHERE username =@TextboxValue", cnn);
  7. cnn.Open();
  8. cmd.CommandType = CommandType.Text;
  9. cmd.Parameters.Add("@TextboxValue", SqlDbType.VarChar).Value = txtUser.Text;
  10. sda = new SqlDataAdapter(cmd);
  11. sda.Fill(Dt);
  12. if (Dt.Rows.Count > 0)
  13. {
  14. //Works - do nothing for now
  15. }
  16. else
  17. {
  18. MessageBox.Show("Username is incorrect!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
  19. }
  20. cnn = new SqlConnection("Server=dbadmin01.database.windows.net;Database=dbadmin;User=info;Password=notGivingThis");
  21. cmd = new SqlCommand("SELECT passcode FROM users WHERE passcode =@PasswordValue", cnn);
  22. cnn.Open();
  23. cmd.CommandType = CommandType.Text;
  24. cmd.Parameters.Add("@PasswordValue", SqlDbType.VarChar).Value = pwdPassword.Password;
  25. sda = new SqlDataAdapter(cmd);
  26. sda.Fill(Dt);
  27. if (Dt.Rows.Count > 0)
  28. {
  29. //Works - Do nothing for now
  30. }
  31. else
  32. {
  33. MessageBox.Show("Password is incorrect!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
  34. }

comments powered by Disqus