zoukankan      html  css  js  c++  java
  • 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;
            }

    天道酬勤,厚积薄发。 君子之行,静以修身,俭以养德。 非淡泊无以明志,非宁静无以致远。 如有恒,何须三更起,半夜眠;最怕莫,三天打鱼两天晒网,竹篮打水一场空。
  • 相关阅读:
    linux getch()实现
    cppcheck 下载与安装(Liunx)
    apt-get 命令
    nanopb 文档
    VS调试技术
    c 单元测试 check
    GDB 调试
    GCC选项 –I,-l,-L
    作业66
    zhuoye
  • 原文地址:https://www.cnblogs.com/houweidong/p/7821073.html
Copyright © 2011-2022 走看看