protected void delete_Click(object sender, EventArgs e) { List <string> eng_ID = new List <string>(); string strID = ""; int rowEffected = 0; string sql_checkEngidUsed = ""; foreach (RepeaterItem labID in Reproject1.Items) { CheckBox chk = (CheckBox)labID.FindControl("CheckBox1"); if (chk.Checked) { //查找该CheckBox所对应纪录的id号,在labID中 strID = ((Label)labID.FindControl("eng_ID")).Text; sql_checkEngidUsed = "select TSA_STFORCODE from TBPM_TCTSASSGN where TSA_STFORCODE='" + strID + "'"; SqlDataReader dr = DBCallCommon.GetDRUsingSqlText(sql_checkEngidUsed); if (dr.HasRows) { Response.Write("<script>alert('工程代号:【" + strID + "】已被引用,无法删除!!!')</script>"); return; } eng_ID.Add(strID); } } lbl_Info.Text += strID; foreach (string id in eng_ID) { DBCallCommon.DeleteENGByENG_ID(id); rowEffected++; } //防止刷新 Response.Redirect("enginfo.aspx?q=1"); Response.Write("<script>alert('数据已删除!!!\\r\\r提示:共删除" + rowEffected + "条记录')</script>"); }
protected void delete_Click(object sender, EventArgs e) { List <string> eng_ID = new List <string>(); string strID = ""; int rowEffected = 0; foreach (RepeaterItem labID in Reproject1.Items) { CheckBox chk = (CheckBox)labID.FindControl("CheckBox1"); if (chk.Checked) { //查找该CheckBox所对应纪录的id号,在labID中 strID = ((Label)labID.FindControl("eng_ID")).Text; eng_ID.Add(strID); } } lbl_Info.Text += strID; foreach (string id in eng_ID) { DBCallCommon.DeleteENGByENG_ID(id); rowEffected++; } //防止刷新 Response.Redirect("enginfo.aspx?q=1"); }