例如;
NO NUMBER
1 13900000000
2 13900000001
……
10000 13900009999
作以下操作
select * from test order by NEWID()再分页!
按下一页会有重复的NUMBER???
NO NUMBER
1 13900000000
2 13900000001
……
10000 13900009999
作以下操作
select * from test order by NEWID()再分页!
按下一页会有重复的NUMBER???
但如果你翻页是通过服务端实现的,那就会有问题了,所以这样的翻页要用客户端实现
就是你说的:
page 1的时候做了一次select,排序了一次,然后再看page2的时候,又call了一次select,于是又随即排序了一次!
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr>
<td width="9" rowspan="2"></td>
<td class="12v">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="12v">
<tr>
<td class="12v" >
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber3" height="0" width="100%">
<tr>
<td>
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6699ff">
<tr>
<td height="20">
<div align="center" class="style1">
<p>东 莞 搜 房 资 讯 手 机 号 码 信 息 一 览 表</p>
<p>13642370000-13642399999</p>
</div>
</td>
</tr>
<tr>
<td height="140" valign="top" bgcolor="#E8F1FF"><br>
<%'开始分页
Const MaxPerPage=900
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end if
set rs=server.createobject("adodb.recordset")
rs.open "select * from test order by NEWID()",conn,1,1
if err.number<>0 then
response.write "数据库中无数据"
end if
if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'> 温馨提示:没有号码可供删除!</p>"
else
totalPut=rs.recordcount if currentpage<1 then
currentpage=1
end if if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"number_test.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim book
book=rs.book
showContent
showpage totalput,MaxPerPage,"number_test.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"number_test.asp"
end if
end if
end if sub showContent
dim i
i=0 %>
<table width="88%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
<form name="form1" method="post" action="houjie_100.asp?action=del">
<tr>
<td width="27%" bgcolor="#E8F1FF"><div align="center">号码列表</div>
<div align="center"></div> <div align="center"></div></td>
</tr>
<%do while not rs.eof%>
<tr>
<td bgcolor="#E8F1FF" style="PADDING-LEFT: 6px"><div align="center"><%=rs("number")%></div> <div align="center"></div> </td>
</tr>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing%>
</form>
</table>
<%
End Sub
Function showpage(totalnumber,maxperpage,filename)
Dim n
If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If
Response.Write "<form method=Post action="&filename&">"
Response.Write "<p align='center' class='contents'> "
If CurrentPage<2 Then
Response.Write "<font class='contents'>首页 上一页</font> "
Else
Response.Write "<a href="&filename&"?page=1 class='contents'>首页</a> "
Response.Write "<a href="&filename&"?page="&CurrentPage-1&" class='contents'>上一页</a> "
End If
If n-currentpage<1 Then
Response.Write "<font class='contents'>下一页 尾页</font>"
Else
Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&" class='contents'>"
Response.Write "下一页</a> <a href="&filename&"?page="&n&" class='contents'>尾页</a>"
End If
Response.Write ""
Response.Write "<font class='contents'> 共有<font color=red>"&totalnumber&"</font>条手机号"
Response.Write "<font class='contents'>转到:</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="¤tpage&">"
Response.Write " <input type='submit' class='contents' value='GO' name='cndok' ></form>"
End Function
%>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td class="12v" width="9" rowspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<br>