Imports System.Data
Imports System.Text.RegularExpressions
Imports System.Data.OleDb
Public Class ShowArticle
    Inherits System.Web.UI.Page

#Region " Web 窗体设计器生成的代码 "

    '该调用是 Web 窗体设计器所必需的。
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents LblTitle As System.Web.UI.WebControls.Label
    Protected WithEvents LblContent As System.Web.UI.WebControls.Label

    '注意: 以下占位符声明是 Web 窗体设计器所必需的。
    '不要删除或移动它。
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
        '不要使用代码编辑器修改它。
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '在此处放置初始化页的用户代码
        Dim StrArticleId As String
        StrArticleId = Request("ArticleId")
        Dim myArticle As New AccessDb
        Dim myReader As OleDbDataReader
        Dim myStrTitle As String
        myReader = myArticle.ExecuteSqlStrDetails("select * from portal_Articles where article)
            HTMLEncode = Str
        End If
    End Function

    '得到字符串长度
    Function strlen(ByVal str As String) As Integer
        Dim p_len As Integer
        Dim xx As Integer
        p_len = 0
        strlen = 0
        If Trim(str) <> "" Then '去掉空格
            p_len = Len(Trim(str))
            For xx = 1 To p_len
                If Asc(Mid(str, xx, 1)) < 0 Then
                    strlen = Int(strlen) + 2
                Else
                    strlen = Int(strlen) + 1
                End If
            Next
        End If
    End Function
    '得到标题,如果多于strlen宽度,则以...显示
    Function gotTopic(ByVal str As String, ByVal strlen1 As String) As String
        Dim l, t, c, i As Integer
        l = Len(str)
        t = 0
        For i = 1 To l
            c = Math.Abs(Asc(Mid(str, i, 1)))
            If c > 255 Then
                t = t + 2
            Else
                t = t + 1
            End If
            If t >= strlen1 Then
                gotTopic = Left(str, i) & "..."
                Exit For
            Else
                gotTopic = str & " "
            End If
        Next
    End Function


    Function RemoveHtml(ByVal str) As String '过滤Html格式
        Dim re As Regex
        str = re.Match(str, "(\<.[^\<]*\>)")
        str = re.Replace(str, " ")
        str = re.Match(str, "(\<\/[^\<]*\>")
        str = re.Replace(str, "")
        RemoveHtml = str
        re = Nothing
    End Function
End Class

相关文章:

  • 2021-04-14
  • 2022-02-16
  • 2021-08-11
  • 2021-09-04
  • 2021-11-30
  • 2021-07-25
  • 2022-12-23
  • 2021-10-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2021-07-04
相关资源
相似解决方案