User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 397,174 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,431 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 1118 | Replies: 5 | Solved
Join Date: Aug 2007
Posts: 98
Reputation: GLT is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
GLT GLT is offline Offline
Junior Poster in Training

Dreamweaver - displaying data from a recordset

  #1  
Mar 18th, 2008
Hi guys!

I was wondering if any of you guys would be able to help solve what is probably a simple problem....

I am using dreamweaver / asp/ access to create a dynamic web application. I have created a record set which queries the database and displays the results. The recordset searches for a product id which is inserted by the user, the product details are then displayed. I somehow can only get the first record in the database to display in the dynamic table. This record is not even searched for it is just there already when i preview the page in the browser then when I enter another ID nothing happens.

here is my code :-

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  2. <!--#include file="Connections/dbtest.asp" -->
  3. <%
  4. Dim rs_search__MMColParam
  5. rs_search__MMColParam = "1"
  6. If (Request.Form("ProductID") <> "") Then
  7. rs_search__MMColParam = Request.Form("ProductID")
  8. End If
  9. %>
  10. <%
  11. Dim rs_search
  12. Dim rs_search_numRows
  13.  
  14. Set rs_search = Server.CreateObject("ADODB.Recordset")
  15. rs_search.ActiveConnection = MM_dbtest_STRING
  16. rs_search.Source = "SELECT * FROM product WHERE ProductID = " + Replace(rs_search__MMColParam, "'", "''") + " ORDER BY ProductID ASC"
  17. rs_search.CursorType = 0
  18. rs_search.CursorLocation = 2
  19. rs_search.LockType = 1
  20. rs_search.Open()
  21.  
  22. rs_search_numRows = 0
  23. %>
  24. <%
  25. Dim Repeat1__numRows
  26. Dim Repeat1__index
  27.  
  28. Repeat1__numRows = 10
  29. Repeat1__index = 0
  30. rs_search_numRows = rs_search_numRows + Repeat1__numRows
  31. %>
  32. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  33. <html>
  34. <head>
  35. <title>search</title>
  36. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  37. </head>
  38.  
  39. <body>Insert product ID you wish to search for:-
  40. <form method="POST" name="formsearch" id="formsearch">
  41. <table width="528" height="136" border="1">
  42. <tr>
  43. <td width="153">productID</td>
  44. <td width="359"><input name="txtProductID" type="text" id="txtProductID" size="50"></td>
  45. <td><input name="btnsearch" type="submit" id="btnsearch" value="search"></td>
  46. </tr>
  47. </table>
  48.  
  49. <input type="hidden" name="MM_search" value="formsearch">
  50. </form>
  51. <p>&nbsp;</p>
  52.  
  53. <table border="1">
  54. <tr>
  55. <td>ProductID</td>
  56. <td>Product</td>
  57. <td>Price</td>
  58. </tr>
  59. <% While ((Repeat1__numRows <> 0) AND (NOT rs_search.EOF)) %>
  60. <tr>
  61. <td><%=(rs_search.Fields.Item("ProductID").Value)%></td>
  62. <td><%=(rs_search.Fields.Item("Product").Value)%></td>
  63. <td><%= FormatCurrency((rs_search.Fields.Item("Price").Value), 2, -2, -2, -2) %></td>
  64. </tr>
  65. <%
  66. Repeat1__index=Repeat1__index+1
  67. Repeat1__numRows=Repeat1__numRows-1
  68. rs_search.MoveNext()
  69. Wend
  70. %>
  71. </table>
  72. </body>
  73. </html>
  74. <%
  75. rs_search.Close()
  76. Set rs_search = Nothing
  77. %>

Any ideas would be greatly appreciated! Thanks!!!

GLT
Last edited by peter_budo : Mar 27th, 2008 at 2:42 am. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP Marketplace
Thread Tools Display Modes

Other Threads in the ASP Forum

All times are GMT -4. The time now is 4:05 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC