please I want Delete and update from gridview using code but not work
this is my code :
/////////////////////////////////// Delete ///////////////////////////////////
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
SqlConnection cn = new SqlConnection();
cn.ConnectionString = ConfigurationManager.ConnectionStrings["ACCITConnectionString"].ConnectionString;
SqlCommand cmd = new SqlCommand("Delete From IdentityType Where IdentityType_ID=" +e.RowIndex , cn);
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
GridView1.EditIndex = -1;
GridView1.DataBind();
}
/////////////////////////////////// update ///////////////////////////////
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int index = GridView1.EditIndex;
GridViewRow row = GridView1.Rows[index];
SqlConnection cn = new SqlConnection();
cn.ConnectionString = ConfigurationManager.ConnectionStrings["ACCITConnectionString"].ConnectionString;
SqlCommand cmd = new SqlCommand("update IdentityType set Where IdentityType_ID=" + e, cn);
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
//Cancel Selected Record After Delete
GridView1.EditIndex = -1;
//Display Data in DataGride
GridView1.DataBind();
}
please help me where is the problem