asp分页的问题,为什么每页多一个出来

来源:百度知道 编辑:UC知道 时间:2024/06/17 00:19:32
'参数:ts条数 ynpage是否分页 0不分 1分
Function Prolist(ts,ynpage)
' oRs.Close
Dim Protype,Pic,ProSql
Protype = saferequest("type",1)
if Protype = "" then
ProSql = "select * from Pro order by Pro_ID desc"
else
ProSql = "select * from Pro where Pro_type = "&Protype&" order by Pro_ID desc"
end if
oRs.PageSize = ts
oRs.CursorLocation = 3
oRs.open ProSql,oConn,1,1
call page1()
response.write "<table><tr>"
for i=0 to oRs.PageSize
if oRs.Eof then exit for
if(i<>0 and (i mod 2)=0) then response.write "</tr><tr>"
%>
<%
if oRs("Pro_Pic") <> "" then
if instr(oRs("Pro_Pic"),"http")=1 then
Pic=oRs("Pro_Pic")
else
Pic=ESCMS_ADMIN_DIR &"/"& oRs("Pro_Pi

简单的for问题,给成这样就行了
for i=1 to oRs.PageSize

说明
for i=0 to 4 '就是0 1 2 3 4,五个数,所以这里要用for i=1 to 4

补充:
if(i<>0 and (i mod 2)=0) then response.write "</tr><tr>"
改成
if(i<>0 and (i mod 2)=1) then response.write "</tr><tr>"

你把TS参数设定为3看看是否是4个了就!
或者更改此处 oRs.PageSize = ts 为oRs.PageSize = ts -1

你调用的时候是这样么:Prolist(4,ynpage)
ts=4么?
如果是这样,那么把
for i=0 to oRs.PageSize 改成for i=1 to oRs.PageSize
也可以这样调用,ts=3 也就是:Prolist(3,ynpage)