using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using MySql.Data.MySqlClient; namespace ekz_lednev { public partial class Form2 : Form { public Form2() { InitializeComponent(); } // Функция добавления private void button1_Click(object sender, EventArgs e) { DB dB = DB.GetInstance(); MySqlCommand cmd = new MySqlCommand($@" INSERT INTO `pozorisp_lednev_ekz`.`Material` (`name`, `material_type_id`, `price_one`, `quantity_real`, `quantity_plan`, `quantity_pack`, `unit_id`) VALUES ('{textBox1.Text}', '{textBox2.Text}', '{textBox3.Text}', '{textBox4.Text}', '{textBox5.Text}', '{textBox6.Text}', '{textBox7.Text}');", dB.GetConnection()); cmd.ExecuteNonQuery(); MessageBox.Show("Добавлено!"); Application.Restart(); } //Обновнление датагридвью и закрытие формочки добавления private void button2_Click(object sender, EventArgs e) { Application.Restart(); this.Close(); } private void button3_Click(object sender, EventArgs e) { MessageBox.Show("Заполните все поля по списку и нажмите кнопку добавить, ваш товар добавлен!"); } private void textBox6_TextChanged(object sender, EventArgs e) { } } }