日期:2014-05-17 浏览次数:20439 次
SqlAA da=new SqlAA(); protected void deleteAll_Click(object sender, EventArgs e) { for (int i = 0; i < GridView1.Rows.Count; i++) { CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1"); string sqlstr = "delete from Photo where PhotoID='" + GridView1.DataKeys[i].Value + "'"; //调用公共类中的 DoSql方法执行删除操作的SQL语句 bool delete = da.DoSql(sqlstr); if (cbox.Checked == true) { if (delete) { Response.Write("<script language=javascript>alert('批量删除成功!');location='Photo.aspx'</script>"); } } else { Response.Write("<script language=javascript>alert('请选择!')</script>"); } } }