RSS Forums RSS
Please support our ASP advertiser: Lunarpages ASP Web Hosting

Dreamweaver - displaying data from a recordset

Join Date: Aug 2007
Posts: 98
Reputation: GLT is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
GLT GLT is offline Offline
Junior Poster in Training

Re: Dreamweaver - displaying data from a recordset

  #5  
Mar 25th, 2008
this is the code i have at the minute:-

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  2. <!--#include file="Connections/dbtest.asp" -->
  3. <%
  4. Dim rs_search__MMColParam
  5. If (Request.Form("ProductID") <> "") Then
  6. rs_search__MMColParam = Request.Form("ProductID")
  7. ElseIf (Request.Form("ProductID") = "") Then
  8. rs_search__MMColParam = "1"
  9. End If
  10. %>
  11. <%
  12. Dim rs_search
  13. Dim rs_search_numRows
  14.  
  15. Set rs_search = Server.CreateObject("ADODB.Recordset")
  16. rs_search.ActiveConnection = MM_dbtest_STRING
  17. rs_search.Source = "SELECT * FROM product WHERE ProductID = " + Replace(rs_search__MMColParam, "'", "''") + " ORDER BY ProductID ASC"
  18. rs_search.CursorType = 0
  19. rs_search.CursorLocation = 2
  20. rs_search.LockType = 1
  21. rs_search.Open()
  22.  
  23. rs_search_numRows = 0
  24. %>
  25. <%
  26. Dim Repeat1__numRows
  27. Dim Repeat1__index
  28.  
  29. Repeat1__numRows = 10
  30. Repeat1__index = 0
  31. rs_search_numRows = rs_search_numRows + Repeat1__numRows
  32. %>
  33. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  34. <html>
  35. <head>
  36. <title>search</title>
  37. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  38. </head>
  39.  
  40. <body>Insert product ID you wish to search for:-
  41. <form method="POST" name="formsearch" id="formsearch">
  42. <table width="528" height="136" border="1">
  43. <tr>
  44. <td width="153">productID</td>
  45. <td width="359"><input name="txtProductID" type="text" id="txtProductID" size="50"></td>
  46. <td><input name="btnsearch" type="submit" id="btnsearch" value="search"></td>
  47. </tr>
  48. </table>
  49.  
  50. <input type="hidden" name="MM_search" value="formsearch">
  51. </form>
  52. <p>&nbsp;</p>
  53. <p>results:-</p>
  54. <table border="1">
  55. <tr>
  56. <td width="87">ProductID</td>
  57. <td width="87">Product</td>
  58. <td width="87">Price</td>
  59. </tr>
  60. <% While ((Repeat1__numRows <> 0) AND (NOT rs_search.EOF)) %>
  61. <tr>
  62. <td><%=(rs_search.Fields.Item("ProductID").Value)%></td>
  63. <td><%=(rs_search.Fields.Item("Product").Value)%></td>
  64. <td><%=(rs_search.Fields.Item("Price").Value)%></td>
  65. </tr>
  66. <%
  67. Repeat1__index=Repeat1__index+1
  68. Repeat1__numRows=Repeat1__numRows-1
  69. rs_search.MoveNext()
  70. Wend
  71. %>
  72. </table>
  73. </body>
  74. </html>
  75. <%
  76. rs_search.Close()
  77. Set rs_search = Nothing
  78. %>
Last edited by peter_budo : Mar 27th, 2008 at 3:42 am. Reason: Keep It Organized - please use [code] tags
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 12:28 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC