Пример #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                String    deleteQuery = "DELETE FROM employee WHERE STAFF_ID = '" + txtStaff_id.Text + "' ";
                dbConnect connect     = new dbConnect();
                connect.Delete(deleteQuery);
                MessageBox.Show("Employee Data Deleted Successfully");
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }

            loadEmployee();
        }
Пример #2
0
        //Delete Product
        private void btnDeleP_Click(object sender, EventArgs e)
        {
            int             selectedrowindex = dgvPDBase.SelectedCells[0].RowIndex;
            DataGridViewRow selectedRow      = dgvPDBase.Rows[selectedrowindex];
            string          a = Convert.ToString(selectedRow.Cells["PRODUCT_ID"].Value);

            String deleteQuery = "DELETE FROM products WHERE PRODUCT_ID = '" + a + "' ";



            if (txtPID.Text != "")
            {
                dbConnect connect = new dbConnect();
                connect.Delete(deleteQuery);

                MessageBox.Show("Property Records Deleted Successfully");
            }
            else
            {
                MessageBox.Show("Invalid Entry");
            }
            loadProduct();
        }