📄 studentinfo.asp
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>学生信息显示页面</title>
<style type="text/css">
<!--
body,td,th {
font-size: 14px;
color: #003399;
}
.style1 {
font-size: 24px;
font-weight: bold;
color: #003366;
font-family: "华文行楷";
}
a:link {
color: #003399;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #003399;
}
a:hover {
text-decoration: none;
color: #003399;
}
a:active {
text-decoration: none;
color: #003399;
}
-->
</style></head>
<body>
<!--#include virtual="../inc/head.htm"-->
<p></p>
<table width="80%" border="1">
<tr>
<th scope="col">需求家教的信息内容</th>
<th scope="col">发布时间</th>
<th scope="col">发布人</th>
</tr>
<%
Set conn=Server.CreateObject("ADODB.Connection")
conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("db/info.mdb")
conn.Open
strSql="select needcontent,puttime,snick from studentinfo order by puttime desc" 'SQL语句,从teacherinfo表中查询家教发布的信息内容,发布时间和昵称
'Set rs=conn.Execute(strSql) 执行SQL语句,返回Recordset对象
Set rs=Server.CreateObject("ADODB.Recordset")
rs.open strSql,conn,1,3
rs.PageSize=2
Page=1 '设置变量Page用来表示当前页号
if Not IsEmpty(Request("Page")) then '判断Page是否已经初始化...
Page=CInt(Request("Page")) '接收Page并化为数字型赋给Page变量
if Page > rs.PageCount then '如果接收的页数大于总页数
rs.AbsolutePage = rs.PageCount '设置当前显示页为末页
else
rs.AbsolutePage = Page '显示当前页等于接收的页数
end if
else
Page = 1 '如果page未被初始化则设为1
End if
rs.AbsolutePage=Page
For i=1 To rs.PageSize '利用for next 循环依次读出记录
if rs.EOF then
Exit For
End If
Response.Write("<tr><td>" & rs("needcontent") & "<td>" & rs("puttime") &_
"<td><a href='studentdetail.asp?name=" & rs("snick") & "'>" & rs("snick") & "</a>" )
rs.MoveNext
Next
%>
</table>
<p>
<div align="center">
<%
if Page>1 then
Response.Write("<a href='studentinfo.asp?Page=1'>首页</a> ")
Response.Write("<a Href='studentinfo.asp?Page=" & (Page-1) & "'> 上一页 </a> ")
end if
if Page< rs.pagecount then
Response.Write("<a href='studentinfo.asp?Page=" & (Page+1) & "'> 下一页 </a> ")
Response.Write("<a href='studentinfo.asp?Page=" & (rs.PageCount) & "'> 尾页 </a>")
end if
%>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -