📄 reviewshow.aspx
字号:
<%@ Page Language="VB" debug="true"%>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.OleDb"%>
<%@ Register TagPrefix="mynews" TagName="top" src="ascx/top.ascx"%>
<%@ Register TagPrefix="mynews" TagName="footer" src="ascx/footer.ascx"%>
<script language="VB" runat="server">
Dim sql, email, content As String
Dim newsid As Integer
Dim myConn As OleDbConnection
Dim myCmd 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), " ")
str = Replace(str, Chr(34), """)
str = Replace(str, Chr(39), "'")
str = Replace(str, Chr(13), "")
str = Replace(str, Chr(10) & Chr(10), "</P><P>")
str = Replace(str, Chr(10), "<BR> ")
Return str
End If
End Function
'初始化新闻评价信息子程序
Sub Page_Load(ByVal sender As Object, ByVal 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
newsid = Page.Request("reviewid")
sql = "select ReViewTitle,Content,Author,Email from ReView where ReviewID=" & newsid
Dim Reader As OleDbDataReader = getdatareader(sql)
While Reader.Read()
title.Text = Reader.Item(0)
content = changecode(Reader.Item(1))
author.Text = Reader.Item(2)
email = Reader.Item(3)
End While
myConn.Close()
End If
End Sub
</script>
<html>
<head>
<title>新闻评论</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" />
<br />
<table width="76%" align="center" cellpadding="0" cellspacing="6">
<tr>
<td align="center">
<asp:label ID="title" runat="server"/>
</td>
</tr>
<tr>
<td align="right" height="30">
作者:<a href="mailto:<%=email%>">
<asp:label ID="author" runat="server"/></a>
</td>
</tr>
<tr>
<td><%=content%></td>
</tr>
</table>
<br />
<mynews:footer runat="server" ID="end1" />
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -