Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. private void Button_Clicked(object sender, EventArgs e)
  2. {
  3.  
  4. string ConnectionString = @"xxxx;User Id=xxxx;Password=xxxx;Database=xxxx";
  5. MySqlConnection myConnection = new MySqlConnection(ConnectionString);
  6.  
  7.  
  8. try
  9. {
  10. if (myConnection.State == System.Data.ConnectionState.Closed) {
  11. myConnection.Open();
  12. databaseText.Text = "Database: ON";
  13. string pass = RandomString(10);
  14. MySqlCommand cmd = new MySqlCommand("UPDATE passwords SET pass = @password", myConnection);
  15. cmd.Parameters.AddWithValue("@password", pass);
  16. cmd.ExecuteNonQuery();
  17.  
  18. myConnection.Close();
  19. }
  20. }
  21. catch (Exception ex)
  22. {
  23. databaseText.Text = ex.ToString();
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement