码迷,mamicode.com
首页 > Web开发 > 详细

asp.net GridView增加删除功能

时间:2017-11-12 12:38:24      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:end   oledb   als   int   ras   net   cmd   tostring   void   

 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;
        }

asp.net GridView增加删除功能

标签:end   oledb   als   int   ras   net   cmd   tostring   void   

原文地址:http://www.cnblogs.com/houweidong/p/7821073.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!