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 project { public partial class RedactorProfile : Form { DataBase dataBase = new DataBase(); public RedactorProfile() { InitializeComponent(); } private void RedactorProfile_Load(object sender, EventArgs e) { // При загрузке формы в поля вставляются данные пользователя comboBox1.Text = Convert.ToString(comboBox1.Items[0]); textBox1.Text = Login.name; textBox2.Text = Login.surname; textBox3.Text = Login.number; } private void button1_Click(object sender, EventArgs e) { dataBase.openConnection(); var addQuery = $"update Employee set name = '{Convert.ToString(textBox1.Text)}', surname = '{Convert.ToString(textBox2.Text)}', number = '{Convert.ToString(textBox3.Text)}', pol = '{Convert.ToString(comboBox1.Text)}' where login = '{Login.login}'"; var command = new SqlCommand(addQuery, dataBase.GetConnection()); command.ExecuteNonQuery(); dataBase.closeConnection(); this.Hide(); Profile profile = new Profile(); profile.Show(); } } }