-2
protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow grow in GridView1.Rows)
{
CheckBox chk = (CheckBox)grow.FindControl("chk1");
if (chk.Checked)
{
int empid =int.Parse((grow.Cells[0]).Text);
deleterecord(empid);
}
}
Bind();
}
protected static void deleterecord(int empid)
{
SqlConnection con = new SqlConnection("Data Source=desktop-tvrrh2v;Initial Catalog=FROMSQL;Integrated Security=True");
SqlCommand cmd = new SqlCommand("delete from grrid where [email protected]", con);
cmd.Parameters.AddWithValue("@id",empid);
con.Open();
cmd.ExecuteNonQuery();
}
Einige Erklärung würde helfen! – kloarubeek