private void btnSave_Click(object sender, EventArgs e) { if (ValidateChildren(ValidationConstraints.Enabled)) { try { BusinessManager BM = new BusinessManager(); // BM.PassImageToDatabase(pictureBox1.Image); BOProduct BO = new BOProduct(); BO.ProductName = cmbProductName.Text; BO.Features = txtFeatures.Text; BO.Price = txtPrice.Text; BO.Picture = BM.ImageToByteArray(pictureBox1.Image); int rowsAffected = BM.BALInsertIntoConfig(BO); if (rowsAffected > 0) { MessageBox.Show("Successfully saved", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information); btnSave.Enabled = false; txtPrice.Text = ""; txtFeatures.Text = ""; pictureBox1.Image = Properties.Resources._12; } else { MessageBox.Show("Couldn't be saved", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.StackTrace, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }