protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
Label lblEmpID = (Label)GridView1.Rows[e.RowIndex].FindControl("Label1"); //This is Table Id load on Label1
conn.Open();
string cmdstr = "delete from LUMHS_CHALLAN_FEE where ID=@ID";
SqlCommand cmd = new SqlCommand(cmdstr, conn);
cmd.Parameters.AddWithValue("@ID", lblEmpID.Text);
cmd.ExecuteNonQuery();
conn.Close();
ShowStudentInfo(); /back to load Grid view Function
}
我想删除gridview中的行,我写了这段代码,但行无法删除请帮帮我
答案 0 :(得分:0)
您的ID是整数还是字符串? 如果是整数,请尝试convert.toInt32(lblEmpID.Text);请