12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- 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_update : Form
- {
- string id_performer;
- public int razmer = 0;
- public static string[] update_performer = new string[1];
- DataBase dataBase = new DataBase();
- public Performer_update(string id_performer, string performer)
- {
- InitializeComponent();
- textBox1.Text = performer;
- this.id_performer = id_performer;
- }
- private void button_save_Click(object sender, EventArgs e)
- {
- if (textBox1.Text.Replace(" ", "") == "") MessageBox.Show("Поле исполнитель не может быть пустым");
- else
- {
- dataBase.openConnection();
- var addQuery = $"update Performer set performer = '{textBox1.Text}' where id_performer = '{id_performer}'";
- var command = new SqlCommand(addQuery, dataBase.GetConnection());
- command.ExecuteNonQuery();
- MessageBox.Show("Запись успешно изменена");
- update_performer[razmer] = textBox1.Text;
- Array.Resize(ref update_performer, update_performer.Length + 1);
- razmer++;
- dataBase.closeConnection();
- this.Hide();
- Performer performer = new Performer();
- performer.ShowDialog();
- }
- }
- private void button_back_Click(object sender, EventArgs e)
- {
- this.Hide();
- Performer performer = new Performer();
- performer.ShowDialog();
- }
- public void global_FormClosed(object sender, EventArgs e)
- {
- Application.Exit();
- }
- }
- }
|