protected bool ImportFromExcelToDelete(DataSet ds) { try { System.Data.DataTable dt = ds.Tables[0]; int nAll = dt.Rows.Count; int nDelete = 0; int nEmpty = 0; foreach (System.Data.DataRow dr in dt.Rows) { if (dr["SelectX"].ToString().ToLower() == "x") { string ECCode = dr["ECCode"].ToString().Trim(); //判断是否存在 if (!ECTagDal.CodeExist(ECCode, "")) { //MessageBox.popupClientMessage(this.Page, " 该机组的输出标签已存在!", "call();"); nEmpty += 1; continue; } else { //main tag ECTagEntity mEntity = new ECTagEntity(); mEntity.ECID = ECTagDal.GetECIDByCode(ECCode); ECTagDal.Delete(mEntity); nDelete += 1; } } } string strInfor = "标签点总数为:{0}个, 删除成功:{1}个,空标签点: {2}个。"; strInfor = string.Format(strInfor, nAll, nDelete, nEmpty); MessageBox.popupClientMessage(this.Page, strInfor, "call();"); return(true); } catch (Exception ee) { // MessageBox.popupClientMessage(this.Page, ee.Message, "call();"); return(false); } }