Advertisement
Guest User

Untitled

a guest
Dec 24th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. string _MySQLReturnString = "";
  2. string _MySQLConnetedString = "server=localhost;user=root;database=plast-service;password =";
  3. MySqlConnection _MySQLConnected = new MySqlConnection(_MySQLConnetedString);
  4. try
  5. {
  6. string _MySQLCommandString = "INSERT INTO `accounts` (id, name, password, email) VALUES ('', @name, @password, @email);";
  7. MySqlCommand _MySQLCommand = new MySqlCommand(_MySQLCommandString, _MySQLConnected);
  8. _MySQLCommand.Parameters.AddWithValue("@name", textBox1.Text);
  9. _MySQLCommand.Parameters.AddWithValue("@password", textBox2.Text);
  10. _MySQLCommand.Parameters.AddWithValue("@email", textBox3.Text);
  11. _MySQLConnected.Open();
  12. _MySQLCommand.ExecuteNonQuery();
  13. _MySQLReturnString = "Вы зарегистрировались.";
  14. }
  15. catch (Exception ex)
  16. {
  17. _MySQLReturnString = "Произошла ошибка, свяжитесь с разработчиком.\n\nОшибка: " + ex.Message;
  18. }
  19. finally
  20. {
  21. _MySQLConnected.Close();
  22. }
  23. MessageBox.Show(_MySQLReturnString, "Информация");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement