- Back to Home »
- ADO.NET »
- Connected Architecture Delete
Posted by :
Sudhir Chekuri
Saturday, 12 March 2016
//Connected architecture - delete
//Delete Category
private void BtnDeleteCategory_Click(object sender, EventArgs e)
{
//SqlCommand to delete Category
SqlCommand cmd = new SqlCommand("exec Usp_DeleteCategory
'" +
CBExistingCategories.Text + "'",
con);
//Open connection
con.Open();
//Execute delete command
int i = cmd.ExecuteNonQuery();
con.Close();
if (i > 0)
{
//Refresh Category list
PopulateCategories();
MessageBox.Show("Category Deleted
Successfully");
}
else { MessageBox.Show("Category Not Deleted"); }