PDA

View Full Version : Either BOF or EOF is True


webmarkart
11-02-2002, 12:49 PM
I am using same select statement in two different sections of this page (www.webmarkart.com/because/default.asp?action=archive). I realize that the 1st time I run it conflicts withthe second because EOF has been reached but I'm not sure of the syntax to set it back for the second time.

here is the code I am using for the second statement:


<H2>Recent Articles</H2>
<%
sql = ""
sql = sql & "SELECT ART_NO,ARTICLE_TITLE,ARTICLE_DATE,ARTICLE,ARTICLE_KEYWORDS "
sql = sql & "FROM ARTICLES "
sql = sql & "WHERE ART_NO > 1 "
sql = sql & "Order By ART_NO DESC"
'Response.Write sql
Set rs = oConn.Execute(sql)
If Not rs.EOF Then
%>
<P>
<%
Do UNTIL Counter = 5
ArtNo = rs("ART_NO")
ArticleTitle = rs("ARTICLE_TITLE")
Article = rs("ARTICLE")
ArtDate = rs("ARTICLE_DATE")
Counter = Counter + 1
%>

<A HREF="default.asp?action=articles&artno=<%= ArtNo %>" TITLE="<%= ArticleTitle %>" onMouseOver="self.status='';return true"><%= ArticleTitle %></A><BR>

<%
rs.MoveNext
LOOP
%>
</P>
<%
Set rs = Nothing
End If
%>

Mhtml
11-02-2002, 01:02 PM
Edit: Why oh why did I think this?

webmarkart
11-02-2002, 01:12 PM
I'm using the exact code for both satements; oConn.Execute(Sql). The only difference is that on one I'm bringing up the 5 newest articles and on the other I'm listing them all. There is a way to SET rs.BOF = True or something like that but I can't get teh syntax correct.

Mhtml
11-02-2002, 01:23 PM
rs.MOVEFIRST

webmarkart
11-02-2002, 01:28 PM
I tried that...

Did I put it in the right spot?


<%
sql = ""
sql = sql & "SELECT ART_NO,ARTICLE_TITLE,ARTICLE_DATE,ARTICLE,ARTICLE_KEYWORDS "
sql = sql & "FROM ARTICLES "
sql = sql & "WHERE ART_NO > 1 "
sql = sql & "Order By ART_NO DESC"
'Response.Write sql
Set rs = oConn.Execute(sql)
rs.MOVEFIRST
If Not rs.EOF Then
%>

webmarkart
11-02-2002, 01:32 PM
here are the two files:

Mhtml
11-02-2002, 01:37 PM
Could you possibly upload the db? I can't test it without it.

webmarkart
11-02-2002, 01:42 PM
here is the database, the default page with the connection string, and all of the includes...

Mhtml
11-02-2002, 02:06 PM
Did you try it before puting in rs.movefirst? I just took it out and bingo..it worked displayed 6 articles which is all that is in there underneath the search which is underneath the recent articles..

Edit: I just realised the prob lol. You set rs = nothing in the first include which stopped the second one from using it, that was the first thing I removed but I wasn't thinking about why my mind just said that isn't supposed to be there.

webmarkart
11-02-2002, 02:08 PM
individually they both work, its only on the archive page that I get the errror (which is the page that I use both).

Mhtml
11-02-2002, 02:10 PM
Ahhh, now I see. What other things on that page access the db?

webmarkart
11-02-2002, 02:11 PM
those are te only two things that use the db...

webmarkart
11-02-2002, 02:15 PM
well its 9:15am here in NY and I'm still up from the night before so thats part of my problem... I need to walk away from it for a while... thanks for your help so far...

Mhtml
11-02-2002, 02:24 PM
It works, the modified includes will work together..
PS: 1:27 am here...so tired. But must code on...

webmarkart
11-02-2002, 05:00 PM
I used the includes that you posted and it doesnt work...

Mhtml
11-02-2002, 11:39 PM
Hmm, refresh? It works perfectly on my computer PWS 4.0

webmarkart
11-04-2002, 04:20 PM
hmm, I uploaded the exact includes that you send and I still get the same errors. What exactly did you change from my original includes? Perhaps its an issue with my server... I'm trying to figure out another way to do this...

webmarkart
11-04-2002, 04:48 PM
never mind, I figured it out! I was using

Do until counter = 5

but I forgot to specify counter = 0 before....

Thanks for the help