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 System.Data.SqlClient; namespace proba { public partial class EditionUpd : Form { string id_edition; public int razmer = 0; public static string[] update_edition = new string[1]; DataBase dataBase = new DataBase(); public EditionUpd(string id_edition, string edition) { InitializeComponent(); textBox1.Text = edition; this.id_edition = id_edition; } public void global_FormClosed(object sender, EventArgs e) { Application.Exit(); } private void button_save_Click(object sender, EventArgs e) { if (textBox1.Text.Replace(" ", "") == "") MessageBox.Show("Поле издатель не может быть пустым"); else { dataBase.openConnection(); var addQuery = $"update Edition set edition = '{textBox1.Text}' where id_edition = '{id_edition}'"; var command = new SqlCommand(addQuery, dataBase.GetConnection()); command.ExecuteNonQuery(); MessageBox.Show("Запись успешно изменена"); update_edition[razmer] = textBox1.Text; Array.Resize(ref update_edition, update_edition.Length + 1); razmer++; dataBase.closeConnection(); this.Hide(); Издатель mfr = new Издатель(); mfr.ShowDialog(); } } private void button_back_Click(object sender, EventArgs e) { this.Hide(); Издатель form1 = new Издатель(); form1.ShowDialog(); } } }