怎么解决这样的问题?
我用了分页通用类来循环得到查询的六条记录,每页显示五条记录.但点击第二页的时候,查找不到记录出错...
主页:
<form name="form1" method="post" action="MultiNumber.asp">
<textarea>.......</textarea>
</form>
MultiNumber.asp页:
<!-- #include file="Inc/page.asp"-->
<% dim text
text=trim(request.form("textarea"))
if text="" then
response.Redirect("MultiNoResult.asp")
else
sp=split(text,chr(13))
sql="select * from product where (Product_Id='"&sp(0)&"'"
for i=1 to UBound(sp)
sql=sql & "or Product_Id='"&mid(sp(i),2)&"'"
next
sql=sql & ")"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
response.write sql
end if
Set mypage=new xdownpage
mypage.getconn=conn
mypage.getsql=sql
mypage.pagesize=5
set rs=mypage.getrs()
.......
......
%>
page页:
'GetURL 得到当前的URL
'更据URL参数不同,获取不同的结果
'
'==================================================================
Private Function GetURL()
Dim strurl,str_url,i,j,search_str,result_url,str_params
search_str="page="
strurl=Request.ServerVariables("URL")
Strurl=split(strurl,"/")
i=UBound(strurl,1)
str_url=strurl(i)'得到当前页文件名
str_params=Trim(Request.ServerVariables("QUERY_STRING"))
If str_params="" Then
result_url=str_url & "?page="
Else
If InstrRev(str_params,search_str)=0 Then
result_url=str_url & "?" & str_params &"&page="
Else
j=InstrRev(str_params,search_str)-2
If j=-1 Then
result_url=str_url & "?page="
Else
str_params=Left(str_params,j)
result_url=str_url & "?" & str_params &"&page="
End If
End If
End If
GetURL=result_url
End Function
现在我查询得到六条记录,但第一页显示五条记录,第二页的链接就变成:http://localhost/*****/MultiNumber.asp?page=2
在获取参数的时候出错了,我该怎么办呢?谢!