private void buttonLogIn_Click(object sender, EventArgs e) { FormAut AutForm = new FormAut(); this.Hide(); AutForm.Show(); }
private void buttonLogIn_Click(object sender, EventArgs e) { if (textBoxN.Text == "") { MessageBox.Show("Введите имя!"); return; } if (textBoxSn.Text == "") { MessageBox.Show("Введите фамилию!"); return; } if (textBoxLog.Text == "") { MessageBox.Show("Введите логин!"); return; } if (textBoxPass.Text == "") { MessageBox.Show("Введите пароль!"); return; } if (check()) { return; } Database db = new Database(); MySqlCommand command = new MySqlCommand("INSERT INTO `users` (`login`, `password`, `name`, `surname`) VALUES (@log, @pass, @name, @surname)", db.GetConnection()); command.Parameters.Add("@log", MySqlDbType.VarChar).Value = textBoxLog.Text; command.Parameters.Add("@pass", MySqlDbType.VarChar).Value = textBoxPass.Text; command.Parameters.Add("@name", MySqlDbType.VarChar).Value = textBoxN.Text; command.Parameters.Add("@surname", MySqlDbType.VarChar).Value = textBoxSn.Text; db.openConnection(); if (command.ExecuteNonQuery() == 1) { MessageBox.Show("Аккаунт был создан"); } else { MessageBox.Show("Аккаунт не был создан"); } db.closeConnection(); FormAut AutForm = new FormAut(); this.Hide(); AutForm.Show(); }