Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 1st, 2007, 03:23 AM
Registered User
 
Join Date: Jul 2007
Location: London, , United Kingdom.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beginning ASP 3.0: Passing ItemID from one page to

Hello,

Hope someone can help ... I'm adapting the Classified application in BEGINNING ASP 3.0 to a comic-book collection tracker. Consequently, I'm making some changes to the way the application works. I've run into a couple of problems, that ought to be easy, but are giving me sleepless nights. Here's the first problem.

When selecting an item in the database to edit the details for the use clicks a linked ID number on a table and this brings up a details form with fields filled in from corresponding fields in the database. Pretty, standard, right? Except that it's not working for me and I can't see why.

Here's the relevant code from the ViewMyComics.asp page ...

Code:
<%
  Dim rsItems
  Set rsItems = Server.CreateObject("ADODB.Recordset")

  rsItems.Open "Item", objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable

  If Not rsItems.EOF Then                    ' current user has items for sale
    Response.Write _ 
      "<table border=""1"" cellspacing=""2"" cellpadding=""2"">" & _
      "<tr>" & _
      "  <th>ID</th>" & _
      "  <th>Issue</th>" & _
      "  <th>Condition</th>" & _
      "  <th>Month</th>" & _
      "  <th>Year</th>" & _
      "</tr>"
    Do While Not rsItems.EOF
      Response.Write _ 
        "<tr align=center>" & _
        "  <td><a href=""item.asp?Action=Edit&Item=" & rsItems("idItem") & """>" & _
                   rsItems("idItem") & "</a></td>" & _ 
        "  <td>" & rsItems("issue") & "</td>" & _
        "  <td>" & rsItems("cond") & "</td>" & _
        "  <td>" & rsItems("month") & "</td>" & _
        "  <td>19" & rsItems("year") & "</td>" & _
        "</tr>"
      rsItems.MoveNext
    Loop
    Response.Write "</table>"
  Else                                          ' user has no items in the database
    Response.Write "<center><h2>No comics saved in database</h2></center>"
  End If 
  rsItems.close
%>
My DB field changes the fieldname from "ItemID" to "idItem" but that shouldn't affect the function ..

The code on the Item.asp page should receive the idItem value and display the relevant data in the form fields. But it doesn't. It just displays the data from the first row of the DB table "Item" ... Here's the Item.asp code:

Code:
<% 
  If blnNew Then %>
    <input type="Hidden" name="idItem" value=""> <%
  Else %>
    <input type="Hidden" name="idItem" value="<%= Request("Item") %>"> <%
  End If
%>
Subsequent to this problem, I have the names of the comic titles ("Amazing Spider-Man", "Journey into Mystery") stored in a separate table, "Title". This is good DB practice, right? But when I try to substitute the Table name "Item" in the ViewMyComics.asp page, I get a SQL error message complaining about the syntax. This is a SQL statement that works just fine on the page that displays the actual table of comics, which can be seen here:

http://www.thestoryworks.com/publish...ng/default.asp

The SQL statement that I know works elsewhere is:

Code:
        Dim rsItem 
        Set rsItem = Server.CreateObject("ADODB.Recordset")
        strSQL = "SELECT Title.titleName, Item.idItem, Item.issue, Item.[month], Item.[year], " & _
      " Item.cond, Item.gcdb, Item.image, Item.cents, Item.have, Item.want, Item.note " & _ 
      " FROM Title INNER JOIN Item ON Title.idTitle = Item.idTitle " & _
      " ORDER BY titleName,month;"

        rsItem.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText
So how do I retrieve the comic book title to include in the ViewMyComics.asp page, and how do I pass the correct ID to the Item.asp page?

Any help would be hugely appreciated ...

Best,


Alan M, London


Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning ASP 3.0 - page 212 issue dynamic2004 BOOK: Beginning ASP 3.0 1 July 15th, 2004 11:36 AM
Passing values between Asp to Aspx page jayaraj VS.NET 2002/2003 2 May 23rd, 2004 06:54 AM
passing values from ASP page to a popup ASP Page astrosmurfboy Classic ASP Basics 3 April 21st, 2004 08:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.