Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string _MySQLReturnString = "";
- string _MySQLConnetedString = "server=localhost;user=root;database=plast-service;password =";
- MySqlConnection _MySQLConnected = new MySqlConnection(_MySQLConnetedString);
- try
- {
- string _MySQLCommandString = "INSERT INTO `accounts` (id, name, password, email) VALUES ('', @name, @password, @email);";
- MySqlCommand _MySQLCommand = new MySqlCommand(_MySQLCommandString, _MySQLConnected);
- _MySQLCommand.Parameters.AddWithValue("@name", textBox1.Text);
- _MySQLCommand.Parameters.AddWithValue("@password", textBox2.Text);
- _MySQLCommand.Parameters.AddWithValue("@email", textBox3.Text);
- _MySQLConnected.Open();
- _MySQLCommand.ExecuteNonQuery();
- _MySQLReturnString = "Вы зарегистрировались.";
- }
- catch (Exception ex)
- {
- _MySQLReturnString = "Произошла ошибка, свяжитесь с разработчиком.\n\nОшибка: " + ex.Message;
- }
- finally
- {
- _MySQLConnected.Close();
- }
- MessageBox.Show(_MySQLReturnString, "Информация");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement