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
- <%
- 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
- %>
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
- <%
- If blnNew Then %>
- <input type="Hidden" name="idItem" value=""> <%
- Else %>
- <input type="Hidden" name="idItem" value="<%= Request("Item") %>"> <%
- End If
- %>
http://www.thestoryworks.com/publish...ng/default.asp
The SQL statement that I know works elsewhere is:
Expand|Select|Wrap|Line Numbers
- 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
Any help would be hugely appreciated ...
Best,
peck2000