中易网

ASP 搜索后,分页不正常

答案:2  悬赏:20  
解决时间 2021-02-16 02:15
ASP 搜索后,分页不正常
最佳答案
fox=trim(request("fox"))
keyword=trim(request("keyword"))
session("foxx")=trim(request("keyword"))
bd=session("foxx")

这里好像没意思直接
fox=trim(request("fox"))
keyword=trim(request("keyword"))
bd=keyword
在传到下一页时
"上一页"

"下一页"

使用这种分页代码好用一点
<%sub listpages(mycondition)
if pages<1 then
exit sub
end if
response.write " 页码:"
if p>0 then
response.write "[上十页] "
end if

'-------------------下面写出当前十个页码

for i=1 to 10
if (p*10+i)>pages then exit for
if currentpage=i then
response.write "[ else
response.write "[ end if
response.write "href="&request.ServerVariables("script_name")&"?currentpage="&i&"&p="&p&mycondition&">"&(p*10+i)&"] "
next

'--------------------察看下十页的连接
if (p*10+10) response.write "[下十页]"
end if
'-----------------------------------------------上下页导航
response.write "   "
if p>0 and currentpage=1 then
response.write "[上页] "
elseif currentpage>1 then
response.write "[上页] "
end if
' '===上页
if (p*10+currentpage) response.write "[下页] "
elseif (p*10+currentpage) response.write "[下页] "
end if
' '===下页
if (p*10+currentpage)>1 then
response.write "[首页] "
end if
' '===首页
if (p*10+currentpage) response.write "[尾页] "
end if
'===尾页
response.write "第"&(p*10+currentpage)&"/"&Pages&"页 共"&Records&"条记录"
end sub
sub myPages(myRS,mysize) '------mysize为内部变量(主页面没有定义),myRS为主页面传递过来的RS对象(地址传递)
if myRS.eof and myRS.bof then str="没有纪录"
if str="" then
if mysize="" or NOT IsNumeric(mysize) then
mysize=15
end if
myRS.PageSize=mysize
pages=myRS.pagecount
records=myRS.recordcount
On Error Resume Next '取得数字
currentPage=request("currentPage")
if currentPage="" then
currentPage=1
end if
currentPage=CInt(currentPage)
if Err.Number <> 0 Then
currentPage=1
Err.Clear
end if
if currentPage<1 then
currentPage=1
elseIf currentPage>10 then
currentPage=10
end if
'----------------处理p
p=request("p")
if p="" then
p=0
end if
p=CLng(p)
if Err.Number <> 0 Then
p=0
Err.Clear
end if
if p<0 then
p=0
end if
'--判断是否出了页数范围
nowPage=p*10+currentPage
if nowPage>pages then
p=(pages-1)\10
currentPage=((pages-1) mod 10)+1
end if
myRS.absolutepage=p*10+currentPage
else
currentPage=1
records=0
pages=1
end if
end sub
dim pages,records,currentPage,p '--------定义变量,这些变量在主页面中,进行地址传递%>
调用时
myPagesize=10
set rs=server.CreateObject("adodb.recordset")
sql="select * from tsjy "
rs.open sql,conn,1,1
myPages rs,myPagesize
'mycondition="&keyword="&keyword '-----如还有关键字这个附加条件,注意开始有个&。
if not rs.eof then
line=myPagesize
do while not rs.eof and line>0
line=line-1
.....
rs.movenext
loop
end if
<%call listpages(mycondition)%>
求采纳为满意回答。
全部回答

代码太乱了,先说说你可以分为两步来做

第一步先把影片价格为0的先列出来,比如只显示id,并分页

接着再用新的记录集把影片信息读取出业,

但是读取影片信息所用的变量和对象都不能和其它的冲突

所以,分页跟读取影片信息是没有关联的。

我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
高考体检验血会验出吸食K粉吗?急急急急!!
我老公查我的全部通话记录和信息内容,我要怎
为什么韩文很多读法跟中文很像
华夏汽车租赁我想知道这个在什么地方
传奇逆天辅助与传奇主宰挂那个好用?我想知道
黔南工程建设监理有限责任公司福泉分公司这个
美国什么牌子烟好
谢娜婚礼唱给张杰的那首英文歌叫什么
苦瓜汁抗癌要加热吗
脚后跟划破什么时候能好
西凤酒泰州总代理在哪里啊,我有事要去这个地
国家公务员考试和省考的区别在哪里
我是男生,高考考完,暑假想去打点工,可以去
神经性耳聋好了大半个月最近又耳朵有回音耳鸣
新星照相复印打字社我想知道这个在什么地方
推荐资讯
杂交金毛犬多少钱一只
货车前轮跑起来颠的厉害 有的时候连倒车镜都
江苏空气质量最差的是南京,现在为什么是连云
求催眠师恋爱手记小说百度云
7.8x-4.2=3.6 解方程
孩子用砖头把别人头打破了该怎么教育他.?
鱼鲜美2号怎么去啊,有知道地址的么
老公拿我身份证可以去他所在的银行调取信誉证
海兴集团这个地址在什么地方,我要处理点事
佳怡物流地址在哪,我要去那里办事
宽带报停,身份证不在身边怎么办
梦幻西游力ps比不加力的多秒多少
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?