asp.net gridview多页时的批量删除

2019-05-12 08:36:29丽君

            {
               sqlText = sqlText + Convert.ToInt32(grwBook.DataKeys[i].Value) + ",";
            }
        }

        //判断是否有选中
        if (sqlText != "(")
        {
            //去掉最后的逗号,并且加上右括号
            sqlText = sqlText.Substring(0, sqlText.Length - 1) + ")";
            sqlText = "delete from Feedback where ID in" + sqlText;
            try
            {
                //执行删除语句
                db.excuteSql(sqlText);
                //重新绑定数据
                common.salert("删除成功");
                datainit();
                //Response.Redirect("book_admin.aspx");
            }
            catch (Exception ex)
            {
                //若有错误发生,输出错误信息
                common.salert(ex.Message);
            }
            finally
            {

            }
        }
        else
        {
            common.salert("您还没有选中有删除的项");