ASP 分頁時計算頁面總數的幾種算法

代碼] 方法一算法

1 ' HTMer_RecordCount爲要計算的頁面總數
2 ' HTMer_RecordCount爲記錄集數
3 ' HTMer_PageSize爲每頁記錄數
4 If HTMer_RecordCount Mod HTMer_PageSize=0 Then
5     HTMer_PageCount=Int(HTMer_RecordCount/HTMer_PageSize)
6 Else
7     HTMer_PageCount=Int(HTMer_RecordCount/HTMer_PageSize)+1
8 End If

[代碼] 方法二

1 ' HTMer_RecordCount爲要計算的頁面總數
2 ' HTMer_RecordCount爲記錄集數
3 ' HTMer_PageSize爲每頁記錄數
4 HTMer_PageCount=Int(HTMer_RecordCount/HTMer_PageSize*-1)*-1

[代碼] 方法三

1 ' HTMer_RecordCount爲要計算的頁面總數
2 ' HTMer_RecordCount爲記錄集數
3 ' HTMer_PageSize爲每頁記錄數
4 HTMer_PageCount=Abs(Int(-(HTMer_RecordCount/HTMer_PageSize)))

[代碼] 方法四

1 ' HTMer_RecordCount爲要計算的頁面總數
2 ' HTMer_RecordCount爲記錄集數
3 ' HTMer_PageSize爲每頁記錄數
4 HTMer_PageCount=Fix(HTMer_RecordCount/HTMer_PageSize)-CInt(CBool(HTMer_RecordCount Mod HTMer_PageSize))
相關文章
相關標籤/搜索