ASP分页时计算页面总数的几种算法小结
程序员文章站
2022-07-01 23:12:14
下面是我从网上找到三种asp分页时计算页面总数的方法,此方法仅为分页时计算页面总数,并非整个分页代码: 方法一 复制代码 代码如下: ' htmer_recordcount...
下面是我从网上找到三种asp分页时计算页面总数的方法,此方法仅为分页时计算页面总数,并非整个分页代码:
方法一
' htmer_recordcount为要计算的页面总数
' htmer_recordcount为记录集数
' htmer_pagesize为每页记录数
if htmer_recordcount mod htmer_pagesize=0 then
htmer_pagecount=int(htmer_recordcount/htmer_pagesize)
else
htmer_pagecount=int(htmer_recordcount/htmer_pagesize)+1
end if
方法二
' htmer_recordcount为要计算的页面总数
' htmer_recordcount为记录集数
' htmer_pagesize为每页记录数
htmer_pagecount=int(htmer_recordcount/htmer_pagesize*-1)*-1
方法三
' htmer_recordcount为要计算的页面总数
' htmer_recordcount为记录集数
' htmer_pagesize为每页记录数
htmer_pagecount=abs(int(-(htmer_recordcount/htmer_pagesize)))
方法四
' htmer_recordcount为要计算的页面总数
' htmer_recordcount为记录集数
' htmer_pagesize为每页记录数
htmer_pagecount=fix(htmer_recordcount/htmer_pagesize)-cint(cbool(htmer_recordcount mod htmer_pagesize))
方法一
复制代码 代码如下:
' htmer_recordcount为要计算的页面总数
' htmer_recordcount为记录集数
' htmer_pagesize为每页记录数
if htmer_recordcount mod htmer_pagesize=0 then
htmer_pagecount=int(htmer_recordcount/htmer_pagesize)
else
htmer_pagecount=int(htmer_recordcount/htmer_pagesize)+1
end if
方法二
复制代码 代码如下:
' htmer_recordcount为要计算的页面总数
' htmer_recordcount为记录集数
' htmer_pagesize为每页记录数
htmer_pagecount=int(htmer_recordcount/htmer_pagesize*-1)*-1
方法三
复制代码 代码如下:
' htmer_recordcount为要计算的页面总数
' htmer_recordcount为记录集数
' htmer_pagesize为每页记录数
htmer_pagecount=abs(int(-(htmer_recordcount/htmer_pagesize)))
方法四
复制代码 代码如下:
' htmer_recordcount为要计算的页面总数
' htmer_recordcount为记录集数
' htmer_pagesize为每页记录数
htmer_pagecount=fix(htmer_recordcount/htmer_pagesize)-cint(cbool(htmer_recordcount mod htmer_pagesize))
下一篇: asp终极防范SQL注入漏洞