⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newshow.aspx

📁 该系统实现新闻浏览
💻 ASPX
字号:
<%@ Page Language="VB" ContentType="text/html" debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Register TagPrefix="mynews" TagName="top" src="ascx/top.ascx"%>
<%@ Register TagPrefix="mynews" TagName="review" src="ascx/review.ascx"%>
<%@ Register TagPrefix="mynews" TagName="newslist" src="ascx/newslist.ascx"%>
<%@ Register TagPrefix="mynews" TagName="footer" src="ascx/footer.ascx"%>

<script language="VB" runat="server">
    Dim sql, newstitle, part1, part2 As String
    Dim newsno As Integer
    Dim myconn As OleDbConnection
    Dim myCmd, newscmd As OleDbCommand
    '获取数据子程序
    Function getdatareader(ByVal sql As String) As OleDbDataReader
        myCmd = New OleDbCommand(sql, myconn)
        myconn.Open()
        getdatareader = myCmd.ExecuteReader()
    End Function
    '替换特殊字符子程序
    Function changecode(ByVal str As String)
        If Len(str) > 0 Then
            str = Replace(str, Chr(32), " ")
            str = Replace(str, Chr(9), "&nbsp;")
            str = Replace(str, Chr(34), "&quot;")
            str = Replace(str, Chr(39), "&#39;")
            str = Replace(str, Chr(13), "")
            str = Replace(str, Chr(10) & Chr(10), "</P><P>")
            str = Replace(str, Chr(10), "<BR> ")
            str = Replace(str, "[img]", "<img src='")
            str = Replace(str, "[/img]", "'>")
            str = Replace(str, "[b]", "<b>")
            str = Replace(str, "[/b]", "</b>")
            str = Replace(str, "[em]", "<em>")
            str = Replace(str, "[/em]", "</em>")
            str = Replace(str, "[u]", "<u>")
            str = Replace(str, "[/u]", "</u>")
            str = Replace(str, "[center]", "<center>")
            str = Replace(str, "[/center]", "</center>")
            str = Replace(str, "[mail]", "<a href='mailto:")
            str = Replace(str, "[url]", "<a href='")
            str = Replace(str, "[|mail]", "'>")
            str = Replace(str, "[|url]", "'>")
            str = Replace(str, "[/hyper]", "</a>")
            str = Replace(str, "[upimg]", "<img src=upload/")
            str = Replace(str, "[/upimg]", ">")
            part1 = Left(str, InStr(str, ">"))
            part2 = Right(str, (Len(str) - InStr(str, ">")))
            str = part1 + part2
            Return str
        End If
    End Function
    '读取新闻详细信息
	Sub Page_Load(sender As Object, e As EventArgs)
        Dim strConn As String
        strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&server.MapPath("./")&"DB_51aspx/news.mdb"	    	
	   	myConn = New OledbConnection(strConn)
   		if not page.ispostback then
		   newsno=Page.request("newsid")
		   sql="select Title,Author,UpdateTime,Original,Content from News where NewsID="&newsno
		   dim reader as OleDbDataReader=getdatareader(sql)
		   while reader.read()
		       session("newstitle")=reader.Item(0)
		       title.text=reader.Item(0)
			   author.text=reader.Item(1)
			   updatetime.text=reader.Item(2)
			   content.text=changecode(reader.Item(4))
			   original.text=reader.Item(3)
		   end while
		   myConn.close()
		end if
    End Sub
</script>

<html>
<head>
<title>新闻:<%=session("newstitle")%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="style.css" type="text/css" rel="Stylesheet"  />
</head>

<body>
<mynews:top runat="server" ID="top1" />
<form id="Form1" runat="server">
<table width="778px" border="0" align="center" cellpadding="0" cellspacing="6px">
    <tr> 
        <td width="70%" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td align="center">
<font color="#009900"><b><asp:label ID="title" runat="server"/></b></font>
        </td>
    </tr>
    <tr>
        <td align="center" height="32px">
作者:<asp:label ID="author" runat="server"/>  
更新时间:<asp:label ID="updatetime" runat="server"/>
        </td>
    </tr>
    <tr>
        <td>
<asp:label ID="content" runat="server"/>
        </td>
    </tr>
    <tr>
        <td align="right" height="36px">
源自:<asp:label ID="original" runat="server"/>
        </td>
    </tr>
    <tr>
        <td>
<mynews:review runat="server"/>
        </td>
    </tr>
</table>
        </td>
        <td align="center" valign="top" nowrap>
<mynews:newslist runat="server"/>       
        </td>
    </tr>
</table>
</form> 
<mynews:footer runat="server" ID="end1" />
</body>
</html>


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -