Exemple #1
0
        private void delivorAddButton_Click(object sender, EventArgs e)
        {
            Delivor delivor = new Delivor();

            delivor.CompanyName     = companyNameField.Text;
            delivor.Address         = addressField.Text;
            delivor.PhoneNumber     = phoneField.Text;
            delivor.EmployeeContact = employeeField.Text;

            dbAccess.insertDelivor(delivor);
        }
        public void insertDelivor(Delivor delivor)
        {
            String query = "insert into Delivors values(N'" + delivor.CompanyName + "',N'" + delivor.Address + "','"
                           + delivor.PhoneNumber + "',N'" + delivor.EmployeeContact + "')";

            command = new SqlCommand(query, connection);

            try
            {
                command.Connection.Open();
                command.ExecuteNonQuery();
                command.Connection.Close();

                MessageBox.Show("Успешно добавен доставчик!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Нещо са прееба брат");
            }
        }