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
大家帮我看看 展开
<%
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
大家帮我看看 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询