That's very strange. objRec should equal Nothing if no rows are
returned, which is confirmed here :-

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/
htm/mdmthcmdexecute.asp

No idea why it's returning a recordset, or why the resulting recordset
doesn't have EOF set to true. Not something I've come across before.

Workarounds are plentiful though - either check the length of the
SACCNum variable before you run the sequel as already suggested, check
whether objRec is nothing using isNothing(), or check
objRec.RecordCount.

Dan

-----Original Message-----
From: GLSmyth [mailto:[EMAIL PROTECTED] 
Sent: 05 April 2005 15:32
To: [email protected]
Subject: Re: [ASP] Apparent Looping Problerm



Dan -

A code example follows:

strSQL = "Select Comp, Web From tblComp Where SA" & SACCNum & " = 'Y'"
objCommand.CommandText = strSQL
Set objRec = objCommand.Execute

While Not objRec.EOF
%>
<tr>
  <td><%=objRec("Comp")%></td>
  <td><a href="http://<%=objRec("Web")%>"><%=objRec("Web")%></a></td>
</tr>
<%
  objRec.MoveNext
Wend

As per querystring value, the information would be selected from the
SA1 or SA2 or SA3 column.  When there is no querystring value, it
apparently is looking for the SA column, which does not exist, and ends
up (also, apparently) looping until all of the memory has been consumed.

My question is "why is a recordset being returned" and "why is it
looping?"

Cheers -

george



--- In [email protected], "Dan Powderhill"
<[EMAIL PROTECTED]> wrote:
> Can you show us the code that creates the recordset and then loops?
> 
> Dan
> 
> -----Original Message-----
> From: GLSmyth [mailto:[EMAIL PROTECTED]
> Sent: 05 April 2005 13:48
> To: [email protected]
> Subject: [ASP] Apparent Looping Problerm
> 
> 
> 
> I have come across a problem and wonder if anyone can explain why this

> might be happening.
> 
> One of my programs uses the value of a query string to determine which

> column within a table to obtain its information.  What I have come to 
> learn is that some spiders are accessing the page and not offering a 
> value in the query string (makes sense).  Because of this, the SQL is 
> trying to get information from a column that does not exist.
> 
> Following the execution of the statement was the standard looping 
> through the records (yes, I know there is a better way, but it was an 
> old program).
> 
> What happened was that apparently the code thought that a recordset 
> had been returned (I would not have thought that that would happen) 
> and it looped endlessly until it has consumed all memory and the 
> server crashed.
> 
> I am not understanding why 1.) the code would think that a recordset 
> was returned, and 2.) why it would continually loop.
> 
> If anyone has any ideas on this then I would greatly appreciate the 
> education.
> 
> Cheers -
> 
> george
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 
>  Home       : http://groups.yahoo.com/group/active-server-pages
> ---------------------------------------------------------------------
>  Post       : [email protected]
>  Subscribe  : [EMAIL PROTECTED]
>  Unsubscribe: [EMAIL PROTECTED]
> ---------------------------------------------------------------------
> Yahoo! Groups Links





---------------------------------------------------------------------

 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [email protected]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links



 





---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [email protected]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to