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