Advertisement
Guest User

Untitled

a guest
May 5th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. SqlConnection cnn = null;
  2. SqlCommand cmd = null;
  3. SqlDataAdapter sda = null;
  4. DataTable Dt = new DataTable();
  5.  
  6. cnn = new SqlConnection("Server=dbadmin01.database.windows.net;Database=dbadmin;User=info;Password=notGivingThis");
  7. cmd = new SqlCommand("SELECT username FROM users WHERE username =@TextboxValue", cnn);
  8. cnn.Open();
  9. cmd.CommandType = CommandType.Text;
  10. cmd.Parameters.Add("@TextboxValue", SqlDbType.VarChar).Value = txtUser.Text;
  11. sda = new SqlDataAdapter(cmd);
  12. sda.Fill(Dt);
  13.  
  14. if (Dt.Rows.Count > 0)
  15. {
  16. //Works - do nothing for now
  17. }
  18. else
  19. {
  20. MessageBox.Show("Username is incorrect!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
  21. }
  22.  
  23. cnn = new SqlConnection("Server=dbadmin01.database.windows.net;Database=dbadmin;User=info;Password=notGivingThis");
  24. cmd = new SqlCommand("SELECT passcode FROM users WHERE passcode =@PasswordValue", cnn);
  25. cnn.Open();
  26. cmd.CommandType = CommandType.Text;
  27. cmd.Parameters.Add("@PasswordValue", SqlDbType.VarChar).Value = pwdPassword.Password;
  28. sda = new SqlDataAdapter(cmd);
  29. sda.Fill(Dt);
  30.  
  31. if (Dt.Rows.Count > 0)
  32. {
  33. //Works - Do nothing for now
  34. }
  35. else
  36. {
  37. MessageBox.Show("Password is incorrect!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement