This is the code of my grid view delete operation using storedprocedure
. I get this error: {"No mapping exists from object type System.Web.UI.WebControls.Label to a known managed provider native type."}
protected void GVEmployee_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
GridViewRow row = GVEmployee.Rows[e.RowIndex];
Control c1 = row.FindControl("Label1");
Label l1 = (Label)c1;
SqlConnection con = new SqlConnection();
con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DBCM"].ConnectionString;
SqlCommand cmd = new SqlCommand("delete from Spempdet where Id= ' " + ID , con);
con.Open();
cmd.Parameters.AddWithValue("@Id", l1);
cmd.ExecuteNonQuery();
con.Close();
Bind();
}