473,407 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Passing ItemID from one page to next

Hope someone can help ... I'm adapting the Classified application in BEGINNING ASP 3.0 (Wrox) 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 ...

Expand|Select|Wrap|Line Numbers
  1. <%
  2.   Dim rsItems
  3.   Set rsItems = Server.CreateObject("ADODB.Recordset")
  4.  
  5.   rsItems.Open "Item", objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable
  6.  
  7.   If Not rsItems.EOF Then                    ' current user has items for sale
  8.     Response.Write _ 
  9.       "<table border=""1"" cellspacing=""2"" cellpadding=""2"">" & _
  10.       "<tr>" & _
  11.       "  <th>ID</th>" & _
  12.       "  <th>Issue</th>" & _
  13.       "  <th>Condition</th>" & _
  14.       "  <th>Month</th>" & _
  15.       "  <th>Year</th>" & _
  16.       "</tr>"
  17.     Do While Not rsItems.EOF
  18.       Response.Write _ 
  19.         "<tr align=center>" & _
  20.         "  <td><a href=""item.asp?Action=Edit&Item=" & rsItems("idItem") & """>" & _
  21.                    rsItems("idItem") & "</a></td>" & _ 
  22.         "  <td>" & rsItems("issue") & "</td>" & _
  23.         "  <td>" & rsItems("cond") & "</td>" & _
  24.         "  <td>" & rsItems("month") & "</td>" & _
  25.         "  <td>19" & rsItems("year") & "</td>" & _
  26.         "</tr>"
  27.       rsItems.MoveNext
  28.     Loop
  29.     Response.Write "</table>"
  30.   Else                                          ' user has no items in the database
  31.     Response.Write "<center><h2>No comics saved in database</h2></center>"
  32.   End If 
  33.   rsItems.close
  34. %>
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:

Expand|Select|Wrap|Line Numbers
  1. <% 
  2.   If blnNew Then %>
  3.     <input type="Hidden" name="idItem" value=""> <%
  4.   Else %>
  5.     <input type="Hidden" name="idItem" value="<%= Request("Item") %>"> <%
  6.   End If
  7. %>
  8.  
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:

Expand|Select|Wrap|Line Numbers
  1.         Dim rsItem 
  2.         Set rsItem = Server.CreateObject("ADODB.Recordset")
  3.         strSQL = "SELECT Title.titleName, Item.idItem, Item.issue, Item.[month], Item.[year], " & _
  4.       " Item.cond, Item.gcdb, Item.image, Item.cents, Item.have, Item.want, Item.note " & _ 
  5.       " FROM Title INNER JOIN Item ON Title.idTitle = Item.idTitle " & _
  6.       " ORDER BY titleName,month;"
  7.  
  8.         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,

peck2000
Jul 2 '07 #1
0 1053

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Paul | last post by:
I want to use sessions to cover myself in case the user switches off cookies so I am passing the session ID manually through a hidden input field. This is what I have so far. index.php page...
1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
2
by: Mat Andrews | last post by:
Hi, I'm comfused with this peice of code which I'm looking at. I can't figure out how it works (and it does appear too); ApplicationData appData = new ApplicationData(); ...
3
by: Lee | last post by:
Hi All How can I pass options from one webpage into another webpage. When the user clicks on the hyperlink I want them to be go to the next page but I need to pass in a number that the next...
4
by: gkr | last post by:
Hi I would like to pass values/data from Page1 to Page 2, then capture values on page 2 and return back to Page 1 with the values from page2. Can you pls guide me on how to do this ? I tried...
2
by: netling | last post by:
Ok, Here is my situation... we have a 64 page pdf that we have broken up into separate pages. We are needing a frame set to have a "Previous Page and Next Page" navigation at the bottom of the...
1
by: gajahkursi | last post by:
<?php // Connect database include("conf.php"); $child= $_POST; // Get all records in all columns from table and put it in $result. $result=mysql_query("SELECT * FROM parent WHERE child=...
5
by: Fran Jakers | last post by:
Hello all, I'm new to all this and I could really use some help. I've searched the web but cannot find an answer. I have an HTML form with 3 radio buttons and a search field that calls a...
6
by: Ria12 | last post by:
hi....i have trouble in passing values of textboxes to next page.There are 3 textboxes in previous page and i have to pass values to next page bases of textbox selected in prevoius page, next page...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.