Results 1 to 5 of 5

Thread: BOF or EOF is true ERROR

  1. #1

    Thread Starter
    Lively Member Brandito's Avatar
    Join Date
    Nov 2000
    Location
    Here, There, Every Where!
    Posts
    106
    Hi,

    I am coding a search engine and message board in .ASP. The problem is I get this error:

    Error Type:
    ADODB.Field (0x80020009)
    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

    I have tracked it down to this:

    <%
    while not rs.eof

    %> <tr><td><a href="<% =rs("location") %>"> <% =rs("iteam") %> </a></td>
    <td bgcolor="beige"> <% =rs("text") %> </td></tr>
    <% rs.movenext

    wend %>

    That code is ran "if not (rs.eof) then".

    Here is my Set statement:

    set conn = server.createobject("adodb.connection")
    conn.open "dsn=search"

    set rs = conn.execute(SQL_String)

    I have used this code before. I don't know what is up. I am running it on an access2000 database on iis 5.0 in IE 5.0. I don't understand how to fix it. Obviously there has to be data in the record set or the code would not even run because of my If statement!!

    If you can help I would appreciate it,
    Brandon

  2. #2
    Addicted Member Active's Avatar
    Join Date
    Jan 2001
    Location
    Lat: 13° 4' 46" N, Long: 80° 15' 20" E
    Posts
    209
    This is Strange...Indeed.

    Well then ...try this Way..


    While Not (rs.EOF or rs.BOF)
    .....

    Wend
    If you can't beat your computer at chess, try kickboxing !!!
    [Download Tag Editing Tools.]

  3. #3
    New Member
    Join Date
    Feb 1999
    Location
    Ft Worth, TX, USA
    Posts
    11

    Wink

    Well, here are a couple comments on what I would do if I were you...

    First of all, who uses a WHILE....WEND Loop?? okay.. that was just mean.. but for reals, that is not a good loop..

    Okay.. here goes a new method to your looping...

    RS.Open.... -Get your records

    IF RS.Recordcount > 0 THEN
    RS.MoveFirst
    For i = 0 to RS.Recordcount

    'Do Your Stuff Here
    RS.MoveNext
    Next
    END IF
    Jay

  4. #4
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    Here is the solution to your problem:

    Code:
    If rs.eof = True and rs.bof = True Then
           Response.Write "There are no records to show."
           Response.End
    Else
           Response.Write "<table>"
           Response.Write "<tr>"
           For each fld in rs.Fields
                  Response.Write "<th>" & fld.Name & "</th>"
           Next
           Response.Write "</tr>"
           Do
                  Response.Write "<tr>"
                  For each fld in rs.Fields
                         Response.Write "<td>" & fld.Value & "</td>"
                  Next
                  Response.Write "</tr>"
           Loop Until rs.Eof = True
           Response.Write "</table>"
    End If
    You are getting that error because when there are no records in your recordset, both the eof and bof are true.

  5. #5

    Thread Starter
    Lively Member Brandito's Avatar
    Join Date
    Nov 2000
    Location
    Here, There, Every Where!
    Posts
    106

    Thumbs up sweet

    Thanx,

    I am going to try this stuff out when I get off work.
    I am hoping the "while not (rs.eof or rs.bof)" will work because I am pretty la-Z.

    It is still strange though. It worked on my work server. But when I tampered with it at my house it blew up.

    Talk 2 u l8r,
    Brandon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width