T
tchangmian
I would like to ask how to return the recordset for page count. The
problem i faced is if it got 2 pages of results, it will display same
results for two page. For example, totally got 17 results, and we
choose 10 records per page, first page should display 10 results,and
2nd page display 7 results. But now first page can display 10 results,
but the 2nd page also display 10 results as 1st page. And when i
respons.write the page count, it return -1 and it suppose to return 2.
Below is my coding:
Set rstStoredProc = objCommand.Execute
if Request.QueryString("PageNum") = "" Then
intPageNum = 1
else
intPageNum = Request.QueryString("PageNum")
End if
Dim avarRecord
if(not rstStoredProc.EOF) Then
rstStoredProc.PageSize = intNumRecInPage
intPageCount = rstStoredProc.PageCount
if IntPageCount <= rstStoredProc.PageCount then
rstStoredProc.AbsolutePage = intPageNum
End If
avarRecord = rstStoredProc.GetRows
if Cint(UBound(avarRecord,2)) < CInt(intNumRecInPage) Then
intNumRecReturn = Cint(UBound(avarRecord,2))
Else
intNumRecReturn = CInt(intNumRecInPage) - 1
End If
problem i faced is if it got 2 pages of results, it will display same
results for two page. For example, totally got 17 results, and we
choose 10 records per page, first page should display 10 results,and
2nd page display 7 results. But now first page can display 10 results,
but the 2nd page also display 10 results as 1st page. And when i
respons.write the page count, it return -1 and it suppose to return 2.
Below is my coding:
Set rstStoredProc = objCommand.Execute
if Request.QueryString("PageNum") = "" Then
intPageNum = 1
else
intPageNum = Request.QueryString("PageNum")
End if
Dim avarRecord
if(not rstStoredProc.EOF) Then
rstStoredProc.PageSize = intNumRecInPage
intPageCount = rstStoredProc.PageCount
if IntPageCount <= rstStoredProc.PageCount then
rstStoredProc.AbsolutePage = intPageNum
End If
avarRecord = rstStoredProc.GetRows
if Cint(UBound(avarRecord,2)) < CInt(intNumRecInPage) Then
intNumRecReturn = Cint(UBound(avarRecord,2))
Else
intNumRecReturn = CInt(intNumRecInPage) - 1
End If