%
If Request("PageNo") <> "" Then
If Request("PageNo") = 0 Then
Response.Redirect "error.asp?Error=You entered page number 0" &_
"
Please go back and enter a valid page number."
End IF
End If
Const adOpenKeyset = 1
Const adLockOptimistic = 3
Dim VClass
Dim strPrice
DIM mySQL, objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
mySQL = "SELECT * FROM Products Where Hide = 'No' Order By ItemNumber"
objRS.Open mySQL, objConn, 1, 3
DIM mySQL2, objRS2, strCount
Set objRS2= Server.CreateObject("ADODB.Recordset")
mySQL2 = "SELECT Count(ItemNumber) AS Total FROM Products Where Hide = 'No'"
objRS2.Open mySQL2, objConn, 1, 3
strCount = objRS2("Total")
If objRS.EOF Then
Else
Dim PageNo
' Setup Recordset
Dim strPageSize
If Request("PageSize") = "" Then
strPageSize = Session("PageSize")
If (strPageSize = "") Then
strPageSize = 10
End If
Else
strPageSize = Request("PageSize")
Session("PageSize") = Request("PageSize")
End If
objRS.PageSize = strPageSize
Dim strPageCount
strPageCount = objRS.PageCount
' Adjust PageNumber as Appropriate
If Request("PageNo") = "" Then
PageNo = 1
Else
PageNo = Request("PageNo")
End If
objRS.AbsolutePage = PageNo
End If
'Make sure page number entered by user is not larger than the last page.
If Request("PageNo") <> "" Then
Dim strCheckTotal
strCheckTotal = Abs(objRS.PageCount)
Dim strPageNum
strPageNum = Abs(Request("PageNo"))
If (strPageNum > strCheckTotal) Then
Response.Redirect "error.asp?Error=You entered page number " & PageNo &_
".
There are only " & strPageCount & " pages of entries." &_
"
Please go back and enter a page number between 1 and " & strPageCount & "."
Else
End If
Else
End If
' End Check page number.
%>
| ||||
| "><%= objRS("ItemNumber") %> | "><%= objRS("Description") %> | "><%= strCurrencySymbol %><%= FormatNumber(strPrice,2) %> |
|
There are <%= strCount %> Items in our database. To view more Items, enter a page number below or click next. |
||
Page <%= PageNo %> of <%= objRS.PageCount %> Pages |
<% If PageNo > 1 Then Dim strBack strBack = Abs(PageNo) - 1 %> <<Back <% End If %> <% If Abs(PageNo) <> Abs(strPageCount) Then Dim strNext strNext = Abs(PageNo) + 1 %> Next>> <% ElseIf Abs(PageNo) = Abs(strPageCount) And Abs(PageNo) <> 1 Then %> Start Over <% End If %> |
|