<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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>
<%
dim totalrecord,currentpage,page,pagec
    currentpage=1
if not request.QueryString("changepage") = "" then
    currentpage=request.QueryString("changepage")(1)
end if
    page=10
    connstr="driver={sql server};server=.;database=northwind;uid=sa;pwd=123456;"
    set conn=server.CreateObject("adodb.connection")
    conn.open connstr
    set rs=server.CreateObject("adodb.recordset")
    sql="select count(*) from customers"
    rs.open sql,conn,0,1
    totalrecord=rs.fields.item(0).value
    rs.close()
    rs.open "select * from customers",conn,0,1
    response.Write("<table border=1>")
    if not rs.bof then
        rs.move page*(currentpage-1)
    end if
    
    for a=0 to page
        if not rs.eof then
            response.Write("<tr>")
            for i=0 to 10
            response.Write("<td>" & rs.fields.item(i).value & "</td>")
            next
            response.Write("</tr>")
            rs.movenext
        end if
    next
    response.Write("</table>")
    
    if (totalrecord mod page) = 0 then
        pagec=totalrecord/page

    else
        pagec=int(totalrecord/page)+1

    end if
%>
当前页<% =currentpage %>/<% =pagec %>
<% if currentpage <= 1 then %>
上一页
<% else %>
<a href="分页.asp?changepage=<% =(currentpage-1) %>">上一页</a>
<% end if %>

<% if currentpage = pagec then %>
下一页
<% else %>
<a href="分页.asp?changepage=<% =(currentpage+1) %>">下一页</a>
<% end if %>
</body>
</html>