Product Range / <%= CID %>
<%
Dim objRS, strSQL1
Dim iPageCount 'The number of pages we get back
Dim strOrderBy 'A fake parameter used to illustrate passing them
Dim objPagingRS 'The ADODB recordset object
Dim iRecordsShown 'Loop controller for displaying just rowsPerPage records
Dim I 'Standard looping var
If SID = "" Then
strSQL1 = "SELECT ProductID, ProductName, ProductDescShort, ProductImageSmall, ProductImageLarge FROM tblProducts WHERE ProductCat = '"& CID &"' ORDER BY ProductID ASC"
Else
strSQL1 = "SELECT ProductID, ProductName, ProductDescShort, ProductImageSmall, ProductImageLarge FROM tblProducts WHERE ProductCat = '"& CID &"' AND ProductSubCat = '"&SID&"' ORDER BY ProductID ASC"
End If
pagenum = Request.QueryString("pagenum")
Set objRS = Server.CreateObject("ADODB.Recordset")
With objRS
objRS.CursorLocation = adUseServer
objRS.PageSize = 3
objRS.Open strSQL1, objConn, adOpenStatic, adLockReadOnly, adCmdText
End With
' Get the count of the pages using the given page size
iPageCount = objRS.PageCount
' If the request page falls outside the acceptable range,
' give them the closest match (1 or max)
If pagenum < 1 Then pagenum = 1
' Check page count to prevent bombing when zero results are returned!
If iPageCount = 0 Then
Response.Write "
" & _
"" & _
"Sorry No Records Found! " & _
" | "
Else
' Move to the selected page
objRS.AbsolutePage = pagenum
End If
%>
Page <%= pagenum %> of <%= iPageCount %>
<%
iRecordsShown = 0
Do While iRecordsShown < objRS.PageSize And Not objRS.EOF
%>
|
<%= objRS("ProductName") %> |
|
<%= objRS("ProductDescShort") %>
|
|