Ejemplo n.º 1
0
        private void backLabel_Click(object sender, EventArgs e)
        {
            this.Hide();
            startForm startForm = new startForm();

            startForm.Show();
        }
Ejemplo n.º 2
0
        private void addButton_Click(object sender, EventArgs e)
        {
            DB           db      = new DB();
            MySqlCommand command = new MySqlCommand("INSERT INTO `users` (`lastName`, `firstName`) VALUES (@lN, @fN)", db.getConnection());

            command.Parameters.Add("@lN", MySqlDbType.VarChar).Value = lastNameTextBox.Text;
            command.Parameters.Add("@fN", MySqlDbType.VarChar).Value = firstNameTextBox.Text;

            db.openConnection();
            if (command.ExecuteNonQuery() == 1)
            {
                MessageBox.Show("Клиент добавлен в базу!");
                this.Hide();
                startForm startForm = new startForm();
                startForm.Show();
            }
            else
            {
                MessageBox.Show("Ошибка регистрации!");
            }
            db.closeConnection();
        }