ASP搜索分页点击下一页时出错! 5

源码:<%search=trim(Request("search"))select1=trim(Request("select1"))selectcaseselect1c... 源码:

<%
search = trim(Request("search"))
select1 = trim(Request("select1"))
select case select1
case "1"
sql = "select * from reg where name like '%" & search & "%' or content like '%" & search & "%' order by id desc"
case "2"
sql = "select * from reg where lxdh like '%" & search & "%' or content like '%" & search & "%' order by id desc"
case "3"
sql = "select * from reg where sfdq like '%" & search & "%' or content like '%" & search & "%' order by id desc"
case "4"
sql = "select * from reg where pq like '%" & search & "%' or content like '%" & search & "%' order by id desc"
end select
%>

<%sub ShowBody(Str)
dim result
dim l
l=len(str)
result=""
dim i
for i = 1 to 100
select case mid(str,i,1)
case "<"
result=result+"<"
case ">"
result=result+">"
case chr(34)
result=result+"""
case "&"
result=result+"&"
case chr(13)
result=result+"<br>"
case chr(9)
result=result+"    "
case chr(32)
'result=result+" "
if i+1<=l and i-1>0 then
if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then
result=result+" "
else
result=result+" "
end if
else
result=result+" "
end if
case else
result=result+mid(str,i,1)
end select
next
response.write result
end sub

const MaxPerPage=20
dim gstBookID
dim totalPut
dim CurrentPage
dim TotalPages
dim i
i=0
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if

set rs=server.createobject("adodb.recordset")
'sql="select * from reg order by id desc"

rs.open sql,db,1,1
if rs.eof or rs.bof then
'response.write "<p align='center'>There is not any message...</p>"
response.write "<script language='javascript'>" & VbCRlf
response.write "alert('SORRY!没有找到您要的信息!');" & VbCrlf
response.write "history.go(-1);" & vbCrlf
response.write "</script>" & VbCRLF
response.end
else
totalPut=rs.recordcount
if currentPage=1 then
showContent
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
else
currentPage=1
showContent
end if
end if
end if
大家帮我看看
展开
 我来答
改变自己2004
2009-03-12 · TA获得超过1794个赞
知道大有可为答主
回答量:2871
采纳率:0%
帮助的人:0
展开全部
你在百度搜索

叶子asp分页类

分页可以选择access或者mssql,听说速度是ASP分页中最快的

现在分页都用类,单独写sql语句很繁锁
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式