protected void Button2_Click(object sender, EventArgs e) { string[] values = Request.Form.GetValues("cbxSelect"); if (values == null || values.Length < 1) { Tz888.Common.MessageBox.Show(this.Page, "请选择最少一条数据...."); } else { Tz888.BLL.Mail.MailInfoBLL email = new Tz888.BLL.Mail.MailInfoBLL(); int max = 0; //成功条数 int min = 0; //失败条数 foreach (string list in values) { bool bl = bll.SelMerchantInfo(Convert.ToInt32(list.ToString().Trim()));//判断是否有这条记录 if (bl == true) { int index = email.InsertEmail(Convert.ToInt32(list.ToString().Trim())); if (index > 0) { max++; } } else { min++; } } Tz888.Common.MessageBox.Show(this.Page, "添加成功" + max + "条!失败" + min + "条!"); // Response.Redirect("mail/MailSupervise.aspx"); } }