asp.net GridView增加删除功能

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string id = GridView1.DataKeys[e.RowIndex].Value.ToString();
        bool b = new olecado().deletecategory(id);
        if (b)
        {
            string bianm = Request.QueryString["bm"].ToString().Trim();
            rebindby(bianm);
        }

}

/// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool deletecategory(string id)
        {
            bool flag = false;
            string cmdtext = "delete from ry where id=@id";
            OleDbParameter[] paras = new OleDbParameter[] { new OleDbParameter("@id", id) };
            int res = olehelper.execnonquery(cmdtext, paras, CommandType.Text);
            if (res > 0)
            {
                flag = true;
            }
            return flag;
        }

上一篇:maya2018卸载/安装失败/如何彻底卸载清除干净maya2018注册表和文件的方法


下一篇:ElasticSearch权威指南学习(映射和分析)