<% 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. %> All Products text="#<%= strText %>" link="#<%= strLink %>" vlink="#<%= strVLink %>" alink="#<%= strALink %>"> <% ' Set Row Color if vClass = "firstrow" then vClass = "secondrow" else vClass = "firstrow" end if ' Move to next recordset until end. objRS.MoveNext ' Don't try to print the EOF record. If objRS.EOF Then Exit For End If Next %>

<% vClass = "firstrow" %> <% If objRS.EOF Then Response.Write"There are no products in our database.

" Else Response.Write"
There are currently " & strCount & " products in our database, " & strPageSize & " per page.

" End If If objRS.EOF Then Response.Write "
Item # Description Price
" Else Dim j For j = 1 to objRS.PageSize If objRS("Price") <> "" Then strPrice = objRS("Price") Else strPrice = 0 End If If objRS("OnSale") = "Yes" Then strPrice = objRS("SalePrice") Else End If %>
"><%= objRS("ItemNumber") %> "><%= objRS("Description") %> "><%= strCurrencySymbol %><%= FormatNumber(strPrice,2) %>

<% If Abs(strPageCount) > 1 Then %>

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 %>

<% End If %> <% End If %>