home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 32 / IOPROG_32.ISO / SOFT / SqlEval7 / devtools / samples / ADO / Web / displayc.asp < prev    next >
Encoding:
Text File  |  1998-10-04  |  2.4 KB  |  83 lines

  1. <%@ LANGUAGE="VBSCRIPT" %>
  2.  
  3. <HTML>
  4. <HEAD>
  5. <META NAME="GENERATOR" Content="Microsoft Visual InterDev 6.0">
  6. <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
  7. <TITLE>NIMS - Product Categories</TITLE>
  8. <LINK REL="stylesheet" TYPE="text/css" HREF="nimstyle.css">
  9. <!-- #include file="ADOVBS.INC" -->
  10. </HEAD>
  11. <BODY>
  12.  
  13. <% 
  14. 'Get the display operation from the querystring
  15. '     The operation determines whether the product information display
  16. '     will contain Update or Remove options.
  17. op = Request.QueryString("op")
  18.  
  19. 'Reference the Session connection variable
  20. cn = Session("cnn")
  21.  
  22. 'Create a recordset
  23. Set CategoryInfo = Server.CreateObject("ADODB.Recordset") 
  24.  
  25. 'Create a query string 
  26. querystr = "SELECT CategoryName, Description, CategoryID FROM Categories Order By CategoryID, CategoryName"
  27.  
  28. 'Open the Recordset with the query string on the connection cn.
  29. CategoryInfo.Open querystr, cn
  30. %>
  31.  
  32. <!-- Output Page Header -->
  33. <CENTER>
  34. <H2>Northwind Inventory Management System</H2>
  35. <HR>
  36. <H3>Product Categories</H3>
  37.  
  38. <% 'Output instructions to the user to select the category of the product
  39.    'they wish to view, update, or remove.
  40. IF op <> "" THEN
  41.     Response.Write "Select the category of the product you wish to " & op & ".<BR><Br>"
  42. ELSE
  43.     Response.Write "Select the category of the products you wish to view.<BR><BR>"
  44. END IF %>
  45.  
  46. <!-- Output the table of categories and their descriptions -->
  47. <TABLE  CELLPADDING=3 BORDER=0 COLSPAN=8>
  48.     <TR>
  49.         <% 'Output the table headers
  50.         For i = 0 To 1
  51.             Response.Write "<TD CLASS=header>" & CategoryInfo.Fields(i).Name & "</TD>"
  52.         NEXT %>
  53.     </TR>
  54.     <% 'Loop through the recordset and output the table values 
  55.     Do While Not CategoryInfo.EOF
  56.         Response.Write "<TR>"
  57.         For i = 0 to 1
  58.             Response.Write "<TD>"
  59.             IF i = 0 THEN 'Make the category name a link to the display products
  60.                           'page with the CategoryID in the querystring %>
  61.                 <A HREF="displayp.asp?CategoryID=<%=CategoryInfo.Fields(2)%>&op=<%=op%>">
  62.                 <%Response.Write CategoryInfo.Fields(i).Value & "</A>"
  63.             ELSE ' Output the category description
  64.                 Response.Write CategoryInfo.Fields(i).Value
  65.             END IF
  66.             Response.Write "</TD>"
  67.         NEXT
  68.         Response.Write "</TR>"
  69.         CategoryInfo.MoveNext
  70.     LOOP %>
  71.     
  72. </TABLE>
  73.  
  74. <%    'Close the recordset
  75.     CategoryInfo.Close %>
  76.  
  77. </CENTER>
  78. <BR><BR><HR>
  79. Return to the <A HREF="default.htm">Main Menu</A>
  80.  
  81. </BODY>
  82. </HTML>
  83.