123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- 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 Performer_add : Form
- {
- public int razmer = 0;
- public static string[] add_performer = new string[1];
- DataBase dataBase = new DataBase();
- public Performer_add()
- {
- InitializeComponent();
- }
- private void button_save_Click(object sender, EventArgs e)
- {
- if (textBox1.Text.Replace(" ", "") == "") MessageBox.Show("Поле исполнитель не может быть пустым");
- else
- {
- dataBase.openConnection();
- var performer = textBox1.Text;
- var addQuery = $"insert into [Performer] (performer) values (N'{performer}')";
- var command = new SqlCommand(addQuery, dataBase.GetConnection());
- command.ExecuteNonQuery();
- MessageBox.Show("Запись успешно добавлена в таблицу");
- add_performer[razmer] = textBox1.Text;
- Array.Resize(ref add_performer, add_performer.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();
- Performer performer = new Performer();
- performer.ShowDialog();
- }
- private void Performer_add_Load(object sender, EventArgs e)
- {
- }
- }
- }
|