ASP分页时计算页面总数的几种算法小结

时间:2022-02-23 13:53:46

下面是我从网上找到三种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))