{$cfg_webname}
主页 > 计算机 > 论文 >

家教信息管理系统毕业论文设计(ASP.NET)(6)

来源:56doc.com  资料编号:5D4532 资料等级:★★★★★ %E8%B5%84%E6%96%99%E7%BC%96%E5%8F%B7%EF%BC%9A5D4532
资料以网页介绍的为准,下载后不会有水印.资料仅供学习参考之用. 帮助
资料介绍

        }
    }

    //删除帖子
    protected void lbtDelPost_Click(object sender, EventArgs e)
    {
        //当前点击的按钮
        LinkButton lb = (LinkButton)sender;
        // 获取传过来的id
        string postId = lb.CommandArgument;
        //删除帖子
        bool b = PostManager.DelPost(postId);
        if (b)
        {
            //重新绑定帖子表
            rePost.DataSource = PostManager.SelectAllPost();
            rePost.DataBind();
        }
        else
        { 
            //帖子删除失败
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('帖子删除失败,请联系管理员!');</script>");
        }
    }
}
#region 取出所有帖子
        /// <summary>
        /// 取出所有帖子
        /// </summary>
        /// <returns></returns>
        public DataTable SelectAllPost()
        {
            DataTable dt = new DataTable();
            dt = sqlhelper.ExecuteQuery("post_SelectAll", CommandType.StoredProcedure);
            return dt;
        }
        #endregion

        #region 添加帖子
        /// <summary>
        /// 添加帖子
        /// </summary>
        /// <param name="p">帖子实体类</param>
        /// <returns></returns>
        public bool InsertPost(Post p)
        {
            bool flag = false;
            string cmdText = "post_Insert";
            SqlParameter[] paras = new SqlParameter[] {
                new SqlParameter("@postTitle",p.PostTitle)  
            };
            int res = sqlhelper.ExecuteNonQuery(cmdText, paras, CommandType.StoredProcedure);
            if (res > 0)
            {
                flag = true;
            }
            return flag;
        }
        #endregion

        #region 删除帖子(连同其下的评论一起删除)
        /// <summary>
        /// 删除帖子(连同其下的评论一起删除)
        /// </summary>
        /// <param name="postId">帖子ID</param>
        /// <returns></returns>
        public bool DelPost(string postId)
推荐资料