I have a business website with a shopping cart and access database. I added some code to the customer order confirmation page that passes the customer order number to the following image upload page. This identifies the uploaded image with an order number and works fine if this is the customers first order. If the order is placed by a repeat customer, the oldest order number is retrieved, not the most recent. Can you please view the added code below and tell me if there is a way to fix this problem. Thanks! Code on confirmation page: <A href="ImageUpload.asp?orderno=<%=orderno %>">upload page</A> Code (markup): Code in upload page: <b>Order number: </b> <% 'if no order number found, display box to enter it If (Request.QueryString("orderno") = "") Then %><input type="text" name="orderno" size="7" value=""><% Else %><input type="hidden" name="orderno" value="<%=Request.QueryString("orderno")%>"><% response.write( Request.QueryString("orderno") ) End If %> Code (markup): Code that queries the database: 'Get current order number. Set rsmod = Server.CreateObject("ADODB.Recordset") rsmod.Open "Select * From orders WHERE id=" & checksqln(orderid) & " ORDER BY orderDate DESC", DB, 1, 3 orderno=rsmod("orderno") cctype=rsmod("cctype") rsmod.Close set rsmod=nothing Code (markup): The added code that sorts the records in reverse order does not seem to change anything.
As long as you are calling the procedure after the order insert, the following should work... try.. "Select * From orders WHERE CustomerID = " & CustomerID & " ORDER BY OrderID DESC"