删除时出现一个这样的错误!要怎么解决啊!集合已修改;可能无法执行枚举操作。
代码: /// <summary>
/// 刷新
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void LinkButton1_Click(object sender, EventArgs e)
{
foreach (RepeaterItem item in RepNews.Items) {
CheckBox ckBox = item.FindControl("chkSelect") as CheckBox;
if (ckBox.Checked)
{
int cellID = Convert.ToInt32(((Label)item.FindControl("Label1")).Text);
string sql = "delete from T_Admin where Id=" + cellID;
if (DbHelp.ExecuteSQLNonquery(sql))
{
Utility.Alert("删除成功!");
DbinRep();
}
else
{
Utility.Alert("删除失败!");
}
} }
DbinRep();
}
代码: /// <summary>
/// 刷新
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void LinkButton1_Click(object sender, EventArgs e)
{
foreach (RepeaterItem item in RepNews.Items) {
CheckBox ckBox = item.FindControl("chkSelect") as CheckBox;
if (ckBox.Checked)
{
int cellID = Convert.ToInt32(((Label)item.FindControl("Label1")).Text);
string sql = "delete from T_Admin where Id=" + cellID;
if (DbHelp.ExecuteSQLNonquery(sql))
{
Utility.Alert("删除成功!");
DbinRep();
}
else
{
Utility.Alert("删除失败!");
}
} }
DbinRep();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货