home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / ch_code / ch22 / prodcat.asp < prev    next >
Encoding:
Text File  |  1998-07-13  |  822 b   |  32 lines

  1. <HTML>
  2. <% 
  3. ReqCategory=Request.QueryString("CategoryID")
  4. ReqName=Request.QueryString("CategoryName")
  5. Set DBObj = Server.CreateObject("ADODB.Connection")  
  6. DBObj.Open "NWindDB"
  7. SQLQuery = "SELECT ProductName, UnitPrice, UnitsInStock FROM Products WHERE CategoryID = " & ReqCategory & " ORDER BY ProductName" 
  8. Set RSProducts = DBObj.Execute(SQLQuery) 
  9. %>
  10.  
  11. <CENTER>
  12. <H1>Query Results</H1>
  13. <H3>List of products in category <% = ReqName %></H3>
  14. </CENTER>
  15.  
  16. <TABLE>
  17. <% Do While Not RSProducts.EOF %>
  18.   <TR>
  19.   <TD> <FONT FACE="Verdana" SIZE=2> 
  20.       <% = RSProducts("ProductName") & " (" & RSProducts("UnitPrice") & ")"  %> 
  21.     </FONT></TD>
  22.   <TD><FONT FACE="Verdana" SIZE=2> 
  23.       <% = RSProducts("UnitsInStock") %> 
  24.     </FONT></TD>
  25.   </TR> 
  26.  
  27. <% 
  28. RSProducts.MoveNext 
  29. Loop 
  30. %>
  31. </TABLE>
  32. </HTML>