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 AddLogistician : Form { SqlCommand query = null; SqlDataReader reader = null; public AddLogistician() { InitializeComponent(); } private void AddLogistician_Load(object sender, EventArgs e) { } private void AddBTN_Click(object sender, EventArgs e) { query = new SqlCommand("insert into logisticians (surname_logistician, name_logistician, midname_logistician, number_passport_logistician, place_passport_logistician, date_passport_logistician, code_passport_logistician, telephone_logistician) values (@surname_logistician, @name_logistician, @midname_logistician, @number_passport_logistician, @place_passport_logistician, @date_passport_logistician, @code_passport_logistician, @telephone_logistician)", dbhelper.sqlConnection); query.Parameters.AddWithValue("surname_logistician", SurnameLogisticianTB.Text); query.Parameters.AddWithValue("name_logistician", NameLogisticianTB.Text); query.Parameters.AddWithValue("midname_logistician", MidnameLogisticianTB.Text); query.Parameters.AddWithValue("number_passport_logistician", NumberPassportLogisticianMTB.Text); query.Parameters.AddWithValue("place_passport_logistician", PlacePassportLogisticianRTB.Text); query.Parameters.AddWithValue("date_passport_logistician", DatePassportLogisticianDTP.Value); query.Parameters.AddWithValue("code_passport_logistician", CodePassportLogisticianMTB.Text); query.Parameters.AddWithValue("telephone_logistician", TelephoneLogisticianMTB.Text); if (query.ExecuteNonQuery().ToString().Equals("1")) { MessageBox.Show("Добавление прошло успешно!", "Уведомление", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } }