<%@ Language=VBScript %> <% Option Explicit %> <% '****************************************************** 'Copyright©2000-2002 MetaLinks.com @ http://metalinks.com '****************************************************** %> RMD Products - On-Line Shopping Catalog
< home apply for employment
Shop On-line Now! Store Now Open

  Browse Our Catalogs:

    <% 'create recordset to show database categories and subcategories Dim Conn, subcatRS, RS, rsCatalog, subcatSQL, SQL, priorCatalog, curCatalog, catalogID, catalogName, subcatalogName, subcatalogID Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open ConString 'check to see if there are any subcatalogs subcatSQL = "SELECT * FROM subCatalogs" Set subcatRS = Conn.Execute( subcatSQL ) If subcatRS.BOF or subcatRS.EOF then Set subcatRS = Nothing 'if there are no subcatalogs create recordset to show categories only Set rsCatalog = Conn.Execute("SELECT * FROM catalogs") While Not rsCatalog.EOF %>
  • &strCatalog_NAME=<% Response.Write Server.URLEncode(rsCatalog("catalogName"))%>"> <%= rsCatalog("catalogName") %>
  • <% rsCatalog.MoveNext Wend rsCatalog.Close Set rsCatalog = Nothing else ' if there are subcatalogs, create recordset to show categories and subcategories (NOTE: you will need a subcategory to display a category) SQL = "SELECT * FROM catalogs,subcatalogs " _ & "WHERE subcatalogs.catalogID = catalogs.catalogID " _ & "ORDER BY catalogs.catalogName, subcatalogs.subcatalogName" Set RS = Conn.Execute( SQL ) priorCatalog = "" Response.Write priorCatalog Do Until RS.EOF %> <% curCatalog = RS("catalogName") catalogID = RS("catalogs.catalogID") catalogName = RS("catalogName") subcatalogName = RS("subcatalogName") subcatalogID = RS("subcatalogID") If curCatalog <> priorCatalog Then If priorCatalog <> "" Then Response.Write "
" End If Response.Write "" Response.Write curCatalog & "" ' clean up the tags! RS.Close Set RS = Nothing End If %>
Featured Product

<% 'This creates a recordset to display featured product(s); 'change productID number in SQL SELECT statement to display another product and 'synchonize with the rsCategories recordset (see below) Dim rsProducts Set rsProducts = Conn.Execute("SELECT productImg, productDesc FROM products WHERE productID = 180 ") While Not rsProducts.EOF %> "> <% Response.Write rsProducts("productDesc") %>

<% rsProducts.MoveNext Wend rsProducts.Close Set rsProducts = Nothing %> <% 'This creates another recordset to display category for GO button. 'You must synchronize the SQL select catalogID number with the featured product productID number. 'For example, the productID "5" referenced above is in the catalogID "2" 'You must also change the "a href" tag to point to the appropriate page by entering the 'appropriate catalogID number and NAME Dim rsCategories Set rsCategories = Conn.Execute("SELECT catalogName FROM catalogs WHERE catalogID = 10001 ") While Not rsCategories.EOF %> In Our <% Response.Write rsCategories("catalogName") %> Catalog <% rsCategories.MoveNext Wend rsCategories.Close Set rsCategories = Nothing Conn.Close Set Conn = Nothing %>