RT,GridView中有双主键如何一次删除多条记录.

解决方案 »

  1.   

    问题描述不清楚 什么时候GridView也有主键这种说法了
      

  2.   

    描述不清
    删除多个可 in (ID号)
      

  3.   

    GridView1.Rows[index].DataKeys.Values[0].ToString(); 
     GridView1.Rows[index].DataKeys.Values[1].ToString(); 
    其他删除一样操作
      

  4.   

    例如Delete A_ATTENDACNE_D WHERE STAFF_CODE='0001' AND ATT_DATE='2012-07-01'
    gridview中第一列是staff_code,第二列是att_date,Gridview中选择多条后如何实现批量删除。
      

  5.   

    一条一条执行SQL语句没有问题,能否只执行一条SQL语句
      

  6.   

    加checkbox,选中的就删除。
    代码如下:protected void btnDelAll_Click(object sender, EventArgs e)
        {
            string ids = string.Empty;
            foreach (GridViewRow gr in this.gvList.Rows)
            {
                CheckBox cb = gr.FindControl("chkID") as CheckBox;
                if (cb.Checked)
                    ids += this.gvList.DataKeys[gr.RowIndex].Value + ",";
            }
            if (!string.IsNullOrEmpty(ids))
            {
                if (!new ArticleManager().DeleteArticles(ids.Substring(0, ids.Length - 1)))
                    Page.ClientScript.RegisterStartupScript(GetType(), "success", "<script>alert('删除失败,请重试!');</script>");
                else
                {
                    this.gvList.DataSource = new ArticleManager().GetArticles();
                    this.gvList.DataBind();
                }
            }
    }