<!--metadata type="typelib" file="c:\program files\common files\system\ado\msado15.dll"-->
<% Set rs=Server.CreateObject("Adodb.recordSet")
Con="Provider=SQLNCLI;Data Source=MICROSOF-3A17C9\SQLEXPRESS;Initial Catalog=person;Integrated Security=SSPI; "
sql="select * from t_teacher order by number"
rs.Open sql,Con,AdOpenStatic,adlockreadonly,adcmdtext
If rs.EOF then
   Response.Write "记录集为空！"
   Response.End
End If
'设置RecordSet对象的每一页数据记录条数的大小
rs.PageSize=4
'设置当前页
CurrentPage=Request.QueryString("pageno")
If CurrentPage="" then CurrentPage=1
CurrentPage=CLng(CurrentPage)
If CurrentPage<1 then CurrentPage=1
If CurrentPage>rs.PageCount then CurrentPage=rs.PageCount
rs.AbsolutePage=CurrentPage  %>
<HTML>
<HEAD><TITLE>分页显示示例</TITLE></HEAD>
<BODY><CENTER>
<H3>教师基本情况一览表</H3><HR>
<TABLE border="1">
<%'输出表头%>
<TR align=center valign=middle height=23>
    <TD> 编号 </TD>
    <TD> 姓名 </TD>
    <TD> 所在系 </TD>
    <TD> 性别 </TD>
    <TD> 工资 </TD>
    <TD> 出生日期 </TD>
    <TD> 操作 </TD>
</TR>
<%'输出当前页面记录
For j=0 To rs.PageSize-1
  Response.Write "<TR align=center valign=middle>"
  For i=0 To rs.fields.count-1
    Response.Write "<TD>" &rs.fields(i).value & "</TD>"
  Next
  Response.Write "<TD><A href='updateshow.asp?no=" &rs("number") &"'>修改</A></TD>"  
  Response.Write "</TR>"
  rs.MoveNext
  If rs.Eof Then Exit For
Next
Response.Write "</TABLE><BR><font size=3>"
'输出上一页、下一页和页码对应的超链
If CurrentPage<>1 then  Response.Write "<A href='8-12.asp?pageno=" &CurrentPage-1 & "'>上一页</A>&nbsp"
For i=1 To rs.PageCount
   If i=currentPage then
      Response.Write i&"&nbsp;"
   Else
      Response.Write "<A href='8-5-1.asp?pageno=" & i &"'>[" & i & "]</A>&nbsp;"
   End If
Next 
If CurrentPage<>rs.PageCount then Response.Write "<A href='8-5-1.asp?pageno="&CurrentPage+1 & "'>下一页</A>&nbsp"
%>
</P>
</BODY>
</HTML>
