<% strAction = Request.QueryString("Action") Search = Request("SearchString") Dir = Request.QueryString("Dir") Pointer = Request.QueryString("Pointer") If Search <> "" Then If Session("Search") <> Search Then Session("Search") = Search End If End If iCounter = 5 iCounted = 0 Select Case Dir Case "" Pointer = 0 Case "For" Pointer = Pointer + iCounter Case "Rev" Pointer = Pointer - iCounter End Select If strAction = "search" then 'Initialize the recordset Set oRS = Server.CreateObject("ADODB.RecordSet") Set oRSCount = Server.CreateObject("ADODB.Recordset") 'Filter the record set SQL ="SELECT * FROM Products_Search WHERE Name LIKE '%" & Session("Search") & "%' OR Description LIKE '%" & Session("Search") & "%'" 'Note that products is a view!!!! SQL2 = "SELECT Count(*) as Counted FROM Products_Search WHERE Name LIKE '%" & Session("Search") & "%' OR Description LIKE '%" & Session("Search") & "%'" 'Open the recordset oRS.Open SQL, oConn oRSCount.Open SQL2, oConn Else 'Get the catalog If Cat = "" Then Cat = Request.QueryString("cat") End If If SubCat = "" then SubCat = Request.QueryString("sub") end if If cat <> "" then 'Initialize the recordset Set oRS = Server.CreateObject("ADODB.RecordSet") Set oRSCount = Server.CreateObject("ADODB.Recordset") 'Filter the record set If SubCat = "" then SQL ="SELECT * FROM Products WHERE Products.CategoryID=" & Cat & "order by name " 'Note that products is a view!!!! SQL2 = "SELECT Count(*) as Counted FROM Products WHERE Products.CategoryID=" & Cat 'Note that products is a view!!!! Else SQL ="SELECT * FROM Products WHERE Products.CategoryID=" & SubCat & "order by name " 'Note that products is a view!!!! SQL2 = "SELECT Count(*) as Counted FROM Products WHERE Products.CategoryID=" & SubCat 'Note that products is a view!!!! End If 'Open the recordset oRS.Open SQL, oConn oRSCount.Open SQL2, oConn eND iF End If If NOT (oRS.EOF = True AND oRS.BOF = True) then %>
<% If Pointer = 0 then Bor = True Else For i = 1 to Pointer oRS.MoveNext If oRS.EOF then Eor = True Exit For End If Next End If Do until oRS.eof iCounted = iCounted + 1 %> <% oRS.MoveNext If iCounted = 5 then Exit Do End If If oRS.EOF then Eor = True End If loop %>
">
Code
<%'=oRS(0).name%><%=oRS("UniqueID")%>
" border=0 width="100" height="100">
<%=oRS("Name")%>

<% strDescription = oRS("Description") strDescription = Replace(strDescription, chr(13), "
") Response.Write strDescription %>
<% 'Check if there is a Parameter1 Para1 = Trim(oRS("Parameter1")) 'If there is none, don't display it If Len(Para1) > 0 then 'Put the parameters in an array dPara1 = Split(Para1, ",") %>
<% Else %>       <% End If %> <% 'Check if there is a Parameter1 Para2 = Trim(oRS("Parameter2")) 'If there is none, don't display it If Len(Para2) > 0 then 'Put the parameters in an array dPara2 = Split(Para2, ",") %>        <% End If %>            
R <%=formatnumber(oRS("Price"),2,-2,-2,-2)%>   ">

     <% If Not Bor = True then %> << Previous 5 <% End If %> <% If Not Eor = True then %> Next 5 >> <% End If %>     
<% Else %>
There are no products in this category.
<% End If Set oRSCount = Nothing Set oRS = Nothing %>