Conn.Open ConnStr
If Trim(Request("Sex")) = "" Or Trim(Request("Sex")) = "男, 女" Then
Sql = "Select * From Dicky"
Else
Sql = "Select * From Dicky Where Sex='"&Trim(Request("Sex"))&"'"
End If
'Response.Write Sql
Set Rs = Server.CreateObject("Adodb.RecordSet")
Rs.Open Sql,Conn,1,1
'Set Rs = Conn.Execute(Sql)
If Rs.Eof Then
Response.Write "<tr align=center><td>对不起,尚无记录!</td></tr>"
Else%>
<tr><th>姓名</th><th>性别</th><th>QQ</th></tr>
<% '*************分頁處理部分By Dicky 2004-12-10 10:49:32**************
Dim Page,Page_Number,TotalRec,MaxPerPage,MM
'Page(當前頁),Page_Number(縂頁數),TotalRec(縂記錄數),MaxPerPage(每頁顯示條數)
MM = 0
If Trim(Request.Form("GotoPage")) <> "" Then
If Not IsNumeric(Trim(Request.Form("GotoPage"))) Then
Page = 1
Else
Page = CLng(Trim(Request.Form("GotoPage")))
End If
Else
Page = 1
End If
Rs.PageSize = 1
MaxPerPage = Rs.pageSize
TotalRec = Rs.RecordCount
Page_Number = Rs.PageCount
If Page_Number = 0 Then Page_Number = 1
If CLng(Page) < 1 Then Page = 1
If Page > Page_Number Then Page = Page_Number
Rs.AbsolutePage = Page
'*************分頁處理部分By Dicky 2004-12-10 10:49:32**************
Do While Not Rs.Eof And MM < MaxPerPage
Response.Write "<tr align=center><td>"&Rs("Name")&"</td><td>"&Rs("Sex")&"</td><td>"&Rs("QQ")&"</td></tr>"
MM = MM + 1
Rs.MoveNext:Loop
End If
Rs.Close
Set Rs = Nothing
Conn.Close
Set Conn = Nothing
%>
</table>
<!-- 分頁公用文件 By Dicky 2004-12-10 11:01:26 -->
<%
'If Page_Number > 1 Then%>
<table width="100%" style="font-size: 9pt; margin-top: 4px">
<form method="post" name="form2">
<tr align="center"><td>
<%
Response.Write "共<b><font color=red>"&TotalRec&"</font></b>条"
Response.Write " 页次:<b><font color=red>"&Page&"</font></b>/<b>"&Page_Number&"</b>页"
Response.Write " 每页<b><font color=red>"&MaxPerPage&"</font></b>条"
%>
分页:<% If Page = 1 Then
Response.Write "[首页]"
Response.Write "[上一页]"
Else
Response.Write "[<a href='javascript:GotoPageSubmit(1);'><font color=blue>首页</font></a>]"
Response.Write "[<a href='javascript:GotoPageSubmit("&Page-1&");'><font color=blue>上一页</font></a>]"
End If
If Page_Number - Page >= 1 Then
Response.Write "[<a href='javascript:GotoPageSubmit("&Page+1&");'><font color=blue>下一页</font></a>]"
Response.Write "[<a href='javascript:GotoPageSubmit("&Page_Number&");'><font color=blue>尾页</font></a>]"
Else
Response.Write "[下一页]"
Response.Write "[尾页]"
End If%>
转到第 <input name="GotoPage" type=text size="3" maxlength="3" style="text-align:center;color:#FF0000;" value="<%=Page%>" onmouseover="this.select();"> 页 <input name=goto type=button onClick="javascript:GotoPageSubmit(form2.GotoPage.value);" value=" Go ">
</td></tr>
</form>
</table>
<%
'End If%>
</body>
</html>
本文地址:http://com.8s8s.com/it/it32782.htm