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 Transportation { public partial class AddExecutor : Form { SqlCommand query = null; public AddExecutor() { InitializeComponent(); } private void AddBTN_Click(object sender, EventArgs e) { query = new SqlCommand("insert into executors (surname_executor, name_executor, midname_executor) values (@surname_executor, @name_executor, @midname_executor)", dbhelper.sqlConnection); query.Parameters.AddWithValue("surname_executor", SurnameExecutorTB.Text); query.Parameters.AddWithValue("name_executor", NameExecutorTB.Text); query.Parameters.AddWithValue("midname_executor", MidnameExecutorTB.Text); if (query.ExecuteNonQuery().ToString().Equals("1")) { MessageBox.Show("Добавление прошло успешно!", "Уведомление", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } }