foreach (DataGridViewRow row in CategoryGV.Rows) { if (bool.Parse(row.Cells[0].Value.ToString())) { string cs = ConfigurationManager.ConnectionStrings["aladin"].ConnectionString; SqlConnection con = new SqlConnection(cs); SqlCommand cmd = new SqlCommand("DELETE FROM lwpos_categories WHERE id= '" + Convert.ToInt32(row.Cells[1].Value) + "' ", con); con.Open(); cmd.ExecuteNonQuery(); con.Close(); } }
if (bool.Parse(row.Cells[0].Value.ToString()))
{
string cs = ConfigurationManager.ConnectionStrings["aladin"].ConnectionString;
SqlConnection con = new SqlConnection(cs);
SqlCommand cmd = new SqlCommand("DELETE FROM lwpos_categories WHERE id= '" + Convert.ToInt32(row.Cells[1].Value) + "' ", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
MessageBox.Show("Deleted Successfully", "Successfull operation", MessageBoxButtons.OK, MessageBoxIcon.Information);