jarv
01-20-2010, 09:29 AM
ok, in my shop database, if someone buys 2 (or more) of the same product it then shows in QTY field as 2 or however many they have bought.
how do i write out(loop through) the products that are duplicated?
my code is below:
<%Dim decodeOfficeType, objField, GetStatus%>
<%
Set rs = Server.CreateObject("ADODB.Recordset")
OrderNumber = request.querystring("ONumber")
rs.ActiveConnection = MM_CON_Database_STRING
rs.source = "SELECT tblCustomerRecords.*, tblCustomerOrders.* FROM tblCustomerRecords LEFT JOIN tblCustomerOrders ON " & _
"tblCustomerRecords.OrderNumber = tblCustomerOrders.OrderNumber WHERE tblCustomerRecords.OrderNumber=" & OrderNumber
rs.open()
%>
</head>
<body>
<%' while not rs.eof %>
<%
Dim OrdStat
OrdStat = "x"
For Each objField In rs.fields
Response.Write "<strong>" & objField.name & ":</strong> " & objField.value & " <span style=""color:blue;"">|</span> "
If objField.name = "OrderStatus" Then OrdStat = objField.value
Next
Response.Write "<br /><a href=""del_note.asp?id="&rs("tblCustomerRecords.id")&""">" & rs("tblCustomerRecords.OrderNumber") &"</a>"
%>
<div id="wrapper">
<div id="top"><img src="../../images/build/Delnote_Header.png" /></div>
<div class="deladdress">
DELIVERY ADDRESS<br /><br />
<%response.write(rs("ShippingNameTitle")&" "&rs("ShippingFirstName")&" "&rs("ShippingFirstName")&"<br />"& _
rs("ShippingAddress1")&"<br />"& _
rs("ShippingAddress2")&"<br />"& _
rs("ShippingCity")&"<br />"& _
rs("ShippingCounty")&"<br />"& _
rs("ShippingPostal")&"<br />"& _
rs("ShippingCountry"))%>
</div>
<div class="date1"><%=FormatDateTime(rs("DateOrdered"),vblongdate)%></div>
<div class="billaddress">
BILLING ADDRESS<br /><br />
<%response.write(rs("BillingNameTitle")&" "&rs("BillingFirstName")&" "&rs("BillingFirstName")&"<br />"& _
rs("BillingAddress1")&"<br />"& _
rs("BillingAddress2")&"<br />"& _
rs("BillingCity")&"<br />"& _
rs("BillingCounty")&"<br />"& _
rs("BillingPostal")&"<br />"& _
rs("BillingCountry"))%>
</div>
<br />
<table ID="table" border="1" width="98%" align="center" style="margin-top:10px; margin-bottom:10px;">
<tr>
<td colspan="5">YOUR ITEMS</td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td>Code</td>
<td>Colour</td>
<td>Size</td>
<td>Description</td>
<td>Price</td>
</tr>
<% while not rs.eof %>
<tr>
<td><%=rs("descriptionofgoods")%></td>
<td><%=rs("option2")%></td>
<td><%=rs("option1")%></td>
<td><%=rs("descriptionofgoods")%></td>
<td><%=rs("itemPrice")%></td>
</tr>
<% rs.MoveNext() :: wend %>
<tr>
<td></td>
<td></td>
<td></td>
<td><style="text-align:right;"><strong>Sub Total<br /><br />Delivery<br /><br />Total</strong></style></td>
<td><%=rs("LineTotal")%></td>
</tr>
</table>
<div id="footer"></div>
</div>
<%' rs.MoveNext() :: wend %>
</body>
</html>
Also, Where I have: <%=rs("LineTotal")%> this is in the database but not showing?! I get the error: ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/paddycampbell.www.co.uk/www/office/orders/del_note.asp, line 0
how do i write out(loop through) the products that are duplicated?
my code is below:
<%Dim decodeOfficeType, objField, GetStatus%>
<%
Set rs = Server.CreateObject("ADODB.Recordset")
OrderNumber = request.querystring("ONumber")
rs.ActiveConnection = MM_CON_Database_STRING
rs.source = "SELECT tblCustomerRecords.*, tblCustomerOrders.* FROM tblCustomerRecords LEFT JOIN tblCustomerOrders ON " & _
"tblCustomerRecords.OrderNumber = tblCustomerOrders.OrderNumber WHERE tblCustomerRecords.OrderNumber=" & OrderNumber
rs.open()
%>
</head>
<body>
<%' while not rs.eof %>
<%
Dim OrdStat
OrdStat = "x"
For Each objField In rs.fields
Response.Write "<strong>" & objField.name & ":</strong> " & objField.value & " <span style=""color:blue;"">|</span> "
If objField.name = "OrderStatus" Then OrdStat = objField.value
Next
Response.Write "<br /><a href=""del_note.asp?id="&rs("tblCustomerRecords.id")&""">" & rs("tblCustomerRecords.OrderNumber") &"</a>"
%>
<div id="wrapper">
<div id="top"><img src="../../images/build/Delnote_Header.png" /></div>
<div class="deladdress">
DELIVERY ADDRESS<br /><br />
<%response.write(rs("ShippingNameTitle")&" "&rs("ShippingFirstName")&" "&rs("ShippingFirstName")&"<br />"& _
rs("ShippingAddress1")&"<br />"& _
rs("ShippingAddress2")&"<br />"& _
rs("ShippingCity")&"<br />"& _
rs("ShippingCounty")&"<br />"& _
rs("ShippingPostal")&"<br />"& _
rs("ShippingCountry"))%>
</div>
<div class="date1"><%=FormatDateTime(rs("DateOrdered"),vblongdate)%></div>
<div class="billaddress">
BILLING ADDRESS<br /><br />
<%response.write(rs("BillingNameTitle")&" "&rs("BillingFirstName")&" "&rs("BillingFirstName")&"<br />"& _
rs("BillingAddress1")&"<br />"& _
rs("BillingAddress2")&"<br />"& _
rs("BillingCity")&"<br />"& _
rs("BillingCounty")&"<br />"& _
rs("BillingPostal")&"<br />"& _
rs("BillingCountry"))%>
</div>
<br />
<table ID="table" border="1" width="98%" align="center" style="margin-top:10px; margin-bottom:10px;">
<tr>
<td colspan="5">YOUR ITEMS</td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td>Code</td>
<td>Colour</td>
<td>Size</td>
<td>Description</td>
<td>Price</td>
</tr>
<% while not rs.eof %>
<tr>
<td><%=rs("descriptionofgoods")%></td>
<td><%=rs("option2")%></td>
<td><%=rs("option1")%></td>
<td><%=rs("descriptionofgoods")%></td>
<td><%=rs("itemPrice")%></td>
</tr>
<% rs.MoveNext() :: wend %>
<tr>
<td></td>
<td></td>
<td></td>
<td><style="text-align:right;"><strong>Sub Total<br /><br />Delivery<br /><br />Total</strong></style></td>
<td><%=rs("LineTotal")%></td>
</tr>
</table>
<div id="footer"></div>
</div>
<%' rs.MoveNext() :: wend %>
</body>
</html>
Also, Where I have: <%=rs("LineTotal")%> this is in the database but not showing?! I get the error: ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/paddycampbell.www.co.uk/www/office/orders/del_note.asp, line 0