VB.NET博客系统(9)

来源:xiaoniu168.com 作者:本站原创 添加时间:2011-11-27 点击数:27812

计算机毕业设计博客日志管理功能介绍:

5.5 博客日志管理
本模块的主要功能:是管理会员发布的日志信息和会员评论的信息

以下是引用片段:

相关代码如下:
        Dim key As String = GridView1.DataKeys(Convert.ToInt32(e.CommandArgument)).Value.ToString()
        If e.CommandName = "Del" Then
            Dim DPath As String
            If Server.MapPath("").Substring(Server.MapPath("").Length - 1, 1) = "\" Then
                DPath = Server.MapPath("")
            Else
                DPath = Server.MapPath("") + "\"
            End If
            DPath = DPath + "..\User\Pic\"
            Dim PicName As String = tmpData.Get_Table("select 图片 from 日志 where  编号=" + key + "").Rows(0)(0).ToString()
            '/删除关联的图片文件
            If File.Exists(DPath & PicName) Then File.Delete(DPath & PicName)
            '删除博客日志
            tmpData.ExecSql("delete from 评论 where 博客编号=" + key + " ")
            tmpData.ExecSql("delete from 日志 where 编号=" + key + "")
            GridView1.DataSource = tmpData.Get_Table("select * from 日志 ")
            GridView1.DataBind()
        ElseIf e.CommandName = "See" Then
            
        End If
    Dim tmpData As New DataControl
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            If Request.QueryString("Tkid") <> "" Then
                '如果没有登陆的会员 屏蔽评论按钮
                If Session("UserId") = Nothing Then Button1.Visible = False

                '根据传递的编号 将当前的日志信息显示在控件中
                Dim DPath As String
                DPath = "..\User\Pic\"
                Dim tmpda As New DataTable()
                tmpda = tmpData.Get_Table("SELECT 日志.编号, 日志.主题, 日志.内容, 日志.图片, 日志.时间,    日志.帐号, 博客.名称 FROM 会员 INNER JOIN       日志 ON 会员.帐号 = 日志.帐号 INNER JOIN       博客 ON 会员.帐号 = 博客.帐号 where 日志.编号=" + Request.QueryString("Tkid"))
                If tmpda.Rows.Count > 0 Then

                    TSpmc.InnerHtml = tmpda.Rows(0)("主题").ToString()
                    TSpjs.InnerHtml = (tmpda.Rows(0)("内容")).Replace
                    TImage.InnerHtml = "" + DPath + tmpda.Rows(0)("图片") + ">"
                    TJg.InnerHtml = "¥ " + tmpda.Rows(0)("时间").ToString()
                    TD1.InnerHtml = tmpda.Rows(0)("名称").ToString()
                    TD2.InnerHtml = tmpda.Rows(0)("帐号").ToString()
                    Me.GridView1.DataSource = tmpData.Get_Table("select * from 评论 where 博客编号=" & Request.QueryString("Tkid") & "")
                    Me.GridView1.DataBind()

                End If
            End If
        End If
    End Sub

〖资料来源:计算机毕业论文 www.xiaoniu168.com

第10页为计算机毕业论文博客空间管理......

【联系方式】

【本站信誉】

用心做计算机毕业设计论文网