📄 output.asp
字号:
<%
'驱动数据库
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("../database/student.mdb")
%>
<%
dim i,intPage,page,pre,last,filepath
set rs = server.CreateObject("adodb.recordset")
sql="select * from score order by ave desc"
rs.PageSize = 20 '这里设定每页显示的记录数
rs.CursorLocation = 3
rs.Open sql,conn,1,3 '这里执行你查询SQL并获得结果记录集
pre = true
last = true
page = trim(Request.QueryString("page"))
if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= rs.PageCount then
intpage = rs.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not rs.eof then
rs.AbsolutePage = intpage
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<table width="500" border="1" align="center">
<tr>
<td><div align="center">成绩显示</div></td>
</tr>
</table>
<p> </p>
<table width="703" height="30" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="150" align="center"><div align="center">学号</div></td>
<td width="150" align="center"><div align="center">姓名</div></td>
<td width="150" align="center"><div align="center">数学</div></td>
<td width="150" align="center"><div align="center">英语</div></td>
<td width="150" align="center"><div align="center">计算机</div></td>
<td width="150" align="center"><div align="center">平均成绩</div></td>
</tr>
</table>
<%
for i=1 to rs.PageSize
if rs.EOF or rs.BOF then exit for
%>
<table width="703" height="30" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="150" align="center" bgcolor="#CCCCCC"><div align="center"><%=rs("studentid")%></div></td>
<td width="150" align="center" bgcolor="#CCCCCC"><div align="center"><%=rs("name")%></div></td>
<td width="150" align="center" bgcolor="#CCCCCC"><div align="center"><%=rs("mat")%></div></td>
<td width="150" align="center" bgcolor="#CCCCCC"><div align="center"><%=rs("eng")%></div></td>
<td width="150" align="center" bgcolor="#CCCCCC"><div align="center"><%=rs("com")%></div></td>
<td width="150" align="center" bgcolor="#CCCCCC"><div align="center"><%=rs("ave")%></div></td>
</tr>
</table>
<%
rs.movenext
next
%>
<table width="651" height="20" border="0" align="center" cellpadding="0" cellspacing="1" borderColorLight=#808080 borderColorDark=#ffffff class="h12">
<tr>
<%if rs.pagecount > 0 then%>
<td width="24%" height="33" align="left">当前页<%=intpage%>/<%=rs.PageCount%></td>
<%else%>
<td width="15%" align="left">当前页0/0</td>
<%end if%>
<td width="61%" align="right"> <a href="output.asp?page=1" style="color:#000000; text-decoration:none">首页</a>|
<%if pre then%>
<a href="output.asp?page=<%=intpage -1%>" style="color:#000000; text-decoration:none">上页</a>| <%end if%>
<%if last then%>
<a href="output.asp?page=<%=intpage +1%>" style="color:#000000; text-decoration:none">下页</a> |<%end if%>
<a href="output.asp?page=<%=rs.PageCount%>" style="color:#000000; text-decoration:none">尾页</a>|转到第
<select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs.PageCount
if i = intpage then%>
<option value="output.asp?page=<%=i%>" selected><%=i%></option>
<%else%>
<option value="output.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select>页</font>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -