110,499
社区成员
发帖
与我相关
我的任务
分享
if (Session["Power"].ToString() == "管理员")
{
Response.Write("<script> alert('您没有去重权限')</script>");
}
else
{
int rows = 0;
BLL.CustomInfor bll = new BLL.CustomInfor();
DataSet ds1 = bll.SelectForDelete("业主");
for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
{
DataSet ds2 = bll.SelectByID("业主", Convert.ToInt32(ds1.Tables[0].Rows[i]["C_id"].ToString()));
for (int j = 0; j < ds2.Tables[0].Rows.Count; j++)
{
if (ds1.Tables[0].Rows[i]["C_Phone"].ToString() == ds2.Tables[0].Rows[j]["C_Phone"].ToString())
{
rows = rows + bll.DeleteCus(Convert.ToInt32(ds2.Tables[0].Rows[j]["C_id"].ToString()));
}
}
}
Response.Write("<script> alert('共删除了" + rows + "条数据')</script>");
}
Bind();
if (Session["Power"].ToString() == "管理员")
{
Response.Write("<script> alert('您没有去重权限')</script>");
}
else
{
int rows = 0;
BLL.CustomInfor bll = new BLL.CustomInfor ();
DataSet ds1 = bll.SelectForDelete("其他");//查询出“其他”类别的数据
for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
{
DataSet ds2 = bll.SelectByID("其他", ds1.Tables[0].Rows[i]["C_Phone"].ToString());//查询出其他类别中电话相同的信息
for (int j = 0; j < ds2.Tables[0].Rows.Count; j++)
{
if (Convert.ToInt32(ds2.Tables[0].Rows[j]["C_Id"].ToString()) > Convert.ToInt32(ds1.Tables[0].Rows[i]["C_Id"].ToString()))
{
rows = rows + bll.DeleteCus(Convert.ToInt32(ds2.Tables[0].Rows[j]["C_id"].ToString()));//删除ID比较大的那一项也就是后插入的那一条数据
}
}
}
Response.Write("<script> alert('共删除了" + rows + "条数据')</script>");
}
Bind();
这是写了注释的代码