Link to home
Start Free TrialLog in
Avatar of judoscott
judoscottFlag for United States of America

asked on

Object doesn't support this property or method: 'EOF'

I have a Do while loop inside another one and when the second one is called I get the following error:

Microsoft VBScript runtime  error '800a01b6'

Object doesn't support this property or method: 'EOF'

/manageAds.asp, line 142
DO WHILE NOT rsCust.EOF
																sqlCust="SELECT * FROM orders_products WHERE orders_id=" & rsCust("orders_id") & ""
																rsOrders=Conn2.Execute(sqlCust)
																
																if rsOrders("products_quantity")>1 THEN
										DO WHILE NOT rsOrders.EOF  <!-- line 142
																	%>
																	<tr>
																		<td align="center" class="bodyTxt"><%=rsCust("orders_id")%></td>
																		<td align="center" class="bodyTxt"><%=rsCust("products_name")%><br><%=rsCust("products_id")%></td>
																		<td align="center" class="bodyTxt"><%=rsCust("products_price")%><br><%=rsCust("products_id")%></td>
																		<%
																			sqlCust="SELECT * FROM ads WHERE orders_id=" & rsCust("orders_id") & ""
																			set rsAds=Conn2.Execute(sqlCust)
																			
																			if NOT rsAds.EOF THEN
																				if rsAds("products_id")=rsCust("products_id") THEN
																			%>
																			<td align="center" class="bodyTxt"><%=rsAds("activationDate")%></td>
																			<td align="center" class="bodyTxt"><%=rsAds("expireDate")%></td>
																			<td align="center" class="bodyTxt">&nbsp;</td>
																			<%
																				ELSE
																			%>
																			<td colspan="4" class="tableSubHead" align="center">
																				This ad is not yet posted.<br>
																				<form name="postAd" method="POST" action="postAd.asp?custID=<%=rsCust("customers_id")%>&orderID=<%=rsOrders("orders_id")%>&productID=<%=rsCust("products_id")%>">
																					<input type="submit" name="submit" value="Post this Ad">
																				</form>																			</td>
																			<%
																				END if
																			ELSE
																		%>
																		<td colspan="4" align="center" class="tableSubHead">
																			<%
																				response.Write("EOF FILE")
																			%>
																			This ad is not yet posted.<br>
																			<form name="postAd" method="POST" action="postAd.asp?custID=<%=rsCust("customers_id")%>&orderID=<%=rsOrders("orders_id")%>&productID=<%=rsCust("products_id")%>">
																				<input type="submit" name="submit" value="Post this Ad">
																			</form>																		</td>
																		<%
																			END if
																		%>
																	</tr>
																	<%
																		rsOrders.MoveNext
																	Loop
																ELSE
															%>
															<tr>
																<td align="center" class="bodyTxt"><%=rsCust("orders_id")%></td>
																<td align="center" class="bodyTxt"><%=rsCust("products_name")%><br><%=rsCust("products_id")%></td>
																<td align="center" class="bodyTxt"><%=rsCust("products_price")%><br><%=rsCust("products_id")%></td>
																<%
																	sqlCust="SELECT * FROM ads WHERE userID=" & request.Cookies("userID") & " AND orders_id=" & rsOrders("orders_id") & ""
																	set rsAds=Conn2.Execute(sqlCust)
																	if NOT rsAds.EOF THEN
																		if rsAds("products_id")=rsCust("products_id") THEN
																	%>
																	<td align="center" class="bodyTxt"><%=rsAds("activationDate")%></td>
																	<td align="center" class="bodyTxt"><%=rsAds("expireDate")%></td>
																	<td align="center" class="bodyTxt">&nbsp;</td>
																	<%
																		ELSE
																	%>
																	<td colspan="4" class="tableSubHead" align="center">
																		This ad is not yet posted.<br>
																		<form name="postAd" method="POST" action="postAd.asp?custID=<%=rsCust("customers_id")%>&orderID=<%=rsOrders("orders_id")%>&productID=<%=rsCust("products_id")%>">
																			<input type="submit" name="submit" value="Post this Ad">
																		</form>																	</td>
																	<%
																		END if
																	ELSE
																%>
																<td colspan="4" class="tableSubHead" align="center">
																	This ad is not yet posted.<br>
																	<form name="postAd" method="POST" action="postAd.asp?custID=<%=rsCust("customers_id")%>&orderID=<%=rsOrders("orders_id")%>&productID=<%=rsCust("products_id")%>">
																		<input type="submit" name="submit" value="Post this Ad">
																	</form>																</td>
																<%
																	END if
																%>
															</tr>
															<%
																END if
																rsCust.MoveNext
															Loop

Open in new window

Avatar of RobSampson
RobSampson
Flag of Australia image

Hi, not sure what happened to your code there, but if you have two recordsets to loop through, you'd normally use something like this:

While Not rsState.EOF
   While Not rsCust.EOF
      rsCust.MoveNext
   Wend
   rsState.MoveNext
Wend

Regards,

Rob.
Avatar of judoscott

ASKER

Sorry, not sure what happened but here is the code:

DO WHILE NOT rsCust.EOF
     sqlCust="SELECT * FROM orders_products WHERE orders_id=" & rsCust("orders_id") & ""
                                                                                                                                rsOrders=Conn2.Execute(sqlCust)
                                                                                                                               
 if rsOrders("products_quantity")>1 THEN
    DO WHILE NOT rsOrders.EOF  <!-- line 142
  %>
<tr>
 <td align="center" class="bodyTxt"><%=rsCust("orders_id")%></td>
<td align="center" class="bodyTxt"><%=rsCust("products_name")%><br><%=rsCust("products_id")%></td>
<td align="center" class="bodyTxt"><%=rsCust("products_price")%><br><%=rsCust("products_id")%></td>
 <%
                                                                                                                                                        sqlCust="SELECT * FROM ads WHERE orders_id=" & rsCust("orders_id") & ""
 set rsAds=Conn2.Execute(sqlCust)
                                                                                                                                                       
if NOT rsAds.EOF THEN
if rsAds("products_id")=rsCust("products_id") THEN
  %>
<td align="center" class="bodyTxt"><%=rsAds("activationDate")%></td>
  <td align="center" class="bodyTxt"><%=rsAds("expireDate")%></td>
<td align="center" class="bodyTxt">&nbsp;</td>
 <%
                                                                                                                                                                ELSE
%>
     <td colspan="4" class="tableSubHead" align="center">
This ad is not yet posted.<br>
                                                                                                                                                                <form name="postAd" method="POST" action="postAd.asp?custID=<%=rsCust("customers_id")%>&orderID=<%=rsOrders("orders_id")%>&productID=<%=rsCust("products_id")%>">
                                                                                                                                                                        <input type="submit" name="submit" value="Post this Ad">
                                                                                                                                                                </form>       </td>
<% END if
       ELSE
 %>
<td colspan="4" align="center" class="tableSubHead">
<%
                                                                                                                                                                response.Write("EOF FILE")
 %>
   This ad is not yet posted.<br>
 <form name="postAd" method="POST" action="postAd.asp?custID=<%=rsCust("customers_id")%>&orderID=<%=rsOrders("orders_id")%>&productID=<%=rsCust("products_id")%>">
                                                                                                                                                                <input type="submit" name="submit" value="Post this Ad">
</form>    </td>
   <%
     END if
  %>
</tr>
 <%
                                                                                                                                                rsOrders.MoveNext
           Loop
            ELSE
%>
     <tr>
 <td align="center" class="bodyTxt"><%=rsCust("orders_id")%></td>
<td align="center" class="bodyTxt"><%=rsCust("products_name")%><br><%=rsCust("products_id")%></td>
  <td align="center" class="bodyTxt"><%=rsCust("products_price")%><br><%=rsCust("products_id")%></td>
<%
   sqlCust="SELECT * FROM ads WHERE userID=" & request.Cookies("userID") & " AND orders_id=" & rsOrders("orders_id") & ""
  set rsAds=Conn2.Execute(sqlCust)
   if NOT rsAds.EOF THEN
if rsAds("products_id")=rsCust("products_id") THEN
 %>
<td align="center" class="bodyTxt"><%=rsAds("activationDate")%></td>
 <td align="center" class="bodyTxt"><%=rsAds("expireDate")%></td>
<td align="center" class="bodyTxt">&nbsp;</td>
  <%
    ELSE
           %>
<td colspan="4" class="tableSubHead" align="center">
 This ad is not yet posted.<br>
<form name="postAd" method="POST" action="postAd.asp?custID=<%=rsCust("customers_id")%>&orderID=<%=rsOrders("orders_id")%>&productID=<%=rsCust("products_id")%>">
 <input type="submit" name="submit" value="Post this Ad">
  </form>   </td>
    <%
         END if
 ELSE
%>
<td colspan="4" class="tableSubHead" align="center">
 This ad is not yet posted.<br>
  <form name="postAd" method="POST" action="postAd.asp?custID=<%=rsCust("customers_id")%>&orderID=<%=rsOrders("orders_id")%>&productID=<%=rsCust("products_id")%>">
  <input type="submit" name="submit" value="Post this Ad">
 </form>  </td>
 <%
       END if
 %>
    </tr>
 <%
   END if
rsCust.MoveNext
Loop

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ah, man,
I can't believe I missed that and worse I paid 475 points for such an easy response.  I was in such a hurry to finish and get the site launched I totally missed that one.  Thanks for your help, must be the easiest points you've ever earned.

Thanks again,

Scott