Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Either BOF or EOF is True, error

    I am encountering the following error if a user enters a story number that does not exist.

    Code:
    ADODB.Field error '80020009' 
    
    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. 
    
    /stories.asp, line 0
    Here is my code.

    Code:
    <%
    strid = Request.QueryString("id")
    Set objRS = objConn.Execute("SELECT * from stories WHERE id = " & strid )
    
    %>
    
    <table width="93%" height="490" border="0" align="center" cellpadding="0" bgcolor="#FFFFFF">
      <td width="25%" height="486" valign="top" bgcolor="#E7ECD9">
            <table width="174" border="0" cellpadding="0" cellspacing="0" class="latestarr">
          </table>
            <div class="">More about... <%=objRS("pname")%></div>
            <div class="latest">
    <a id="showAll" href="javascript:" onclick="showHideAll(this)" onmouseover="status=this.innerHTML; return true" onmouseout="status=''">Show all</a></p>
    	<div id="question_<%=objRS("id")%>"><a href="#" id="lnk_<%=objRS("id")%>" onclick="showHide('<%=objRS("id")%>'); return false"  onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="/arrows5.gif" width="17" height="17"></a> <%=objRS("quote")%>  </div>
        <div id="answer_<%=objRS("id")%>" class="answers"><%=objRS("information")%></p></div>
    	<div id="question1_<%=objRS("id")%>"><a href="#" id="lnk1_<%=objRS("id")%>" onclick="showHide1('<%=objRS("id")%>'); return false"  onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="images1/arrows5.gif" width="17" height="17"></a> <%=objRS("activities_title")%>  </div>
        <div id="answer1_<%=objRS("id")%>" class="answers1"><%=objRS("activities")%></div>
    	<div id="question2_<%=objRS("id")%>"><a href="#" id="lnk2_<%=objRS("id")%>" onclick="showHide2('<%=objRS("id")%>'); return false"  onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="http://images1/arrows5.gif" width="17" height="17"></a> <%=objRS("reflect_title")%>  </div>
        <div id="answer2_<%=objRS("id")%>" class="answers2"><%=objRS("reflect")%></div>
    	<div id="question3_<%=objRS("id")%>"><a href="#" id="lnk3_<%=objRS("id")%>" onclick="showHide3('<%=objRS("id")%>'); return false"  onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="http:///arrows5.gif" width="17" height="17"></a> <%=objRS("tools_title")%>  </div>
        <div id="answer3_<%=objRS("id")%>" class="answers3"><%=objRS("tools")%></div><br>
     </div>
    	</td><td width="60%" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" valign="top">
            <td height="80" valign="top"><div class="latestcontain1">Location: The Stories </div> 
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
    
    <%
    	Function RegExpReplace(Str, Pattern, Replacement)
    		Set objRegExp = New RegExp
    		objRegExp.Pattern = Pattern
    		objRegExp.Global = True
    		objRegExp.ignoreCase = true
    		RegExpReplace = objRegExp.Replace(Str, Replacement)
    		Set objRegExp = Nothing
    	End Function
    
    
    	dim arrWords
    	
    
    
    strid = Request.QueryString("id")
    
    	strSQLText = "SELECT * from stories WHERE  id = " & strid
    	strSQLWords = "SELECT title from glossary "
    
    
    
    
    	set rsWords = server.createobject("ADODB.recordset")
    	rsWords.ActiveConnection = strConnection
    	rsWords.Source = strSQLWords
    	rsWords.Open()
    	arrWords = rsWords.getRows()
    	rsWords.Close()
    
    
    	'  Build regular expression for linking'
    	strPattern = "\b("
    
    	for i = 0 to ubound(arrWords, 2)
    		strPattern = strPattern & arrWords(0, i)
    		if i < uBound(arrWords, 2) then
    			strPattern = strPattern & "|"
    		end if
    	next
    	strPattern = strPattern & ")\b"
    
    	set rsText = server.createobject("ADODB.recordset")
    	rsText.ActiveConnection = strConnection
    	rsText.Source = strSQLText
    	rsText.Open()
    	strText = rsText("title")
    	strintro = rsText("introduction")
    	rsText.Close()
    
    if not objRS.eof then 
            do while not objRS.eof
    
    		varPath = "http://www.domain.com/pdf/" & objRS("STORY_IDENTIFIER") & ".pdf"
    		Response.Write "<TD>" 
    		Response.Write "<div id=indexContent><span class=""header"">"
    		Response.Write  RegExpReplace(strText, strPattern, "<a href=""http://www.domain.com</a>")
    		Response.Write"</span>"
    		Response.Write  RegExpReplace(strintro, strPattern, "<a href=""http://www.domain.com</a>")
    		Response.Write objRS("RELEVENT") 
    		Response.Write objRS("FULLTEXTLINK")
    		Response.Write "<span class=""header"">View or print the story</span>" & "<a href=""" & varPath & """  target=""_blank"">" & "<br><br>" & "PDF" & "</a>" 
    		Response.Write "</TD>" 
    		
    		objRS.movenext 
            loop 
        else 
            response.write "No stories matched your search." 
        end if 
    
    
    
    objRS.Close
    set objRS = Nothing
    objConn.Close
    set objConn = Nothing
    
    %>
    What is going wrong?

    Cheers

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Check EOF before extracting values from the recordset:
    if not objRS.eof then

    You are doing it in a few places, but not in the beginning?

    Good luck;

  • #3
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have tried
    Code:
    if not objRS.eof then
    and i am presented with "No records found". Whatever i change if i go past the number of records in the database i get

    Code:
    ADODB.Field error '80020009' 
    
    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
    Frustrating...

  • #4
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Right, did you add it at the top where you do the first query?
    Code:
    <%
    strid = Request.QueryString("id")
    Set objRS = objConn.Execute("SELECT * from stories WHERE id = " & strid )
    
    %>
    
    <table width="93%" height="490" border="0" align="center" cellpadding="0" bgcolor="#FFFFFF">
      <td width="25%" height="486" valign="top" bgcolor="#E7ECD9">
            <table width="174" border="0" cellpadding="0" cellspacing="0" class="latestarr">
          </table>
            <div class="">More about... <%=objRS("pname")%></div>
            <div class="latest">
    <a id="showAll" href="javascript:" onclick="showHideAll(this)" onmouseover="status=this.innerHTML; return true" onmouseout="status=''">Show all</a></p>
        <div id="question_<%=objRS("id")%>"><a href="#" id="lnk_<%=objRS("id")%>" onclick="showHide('<%=objRS("id")%>'); return false"  onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="/arrows5.gif" width="17" height="17"></a> <%=objRS("quote")%>  </div>
        <div id="answer_<%=objRS("id")%>" class="answers"><%=objRS("information")%></p></div>
        <div id="question1_<%=objRS("id")%>"><a href="#" id="lnk1_<%=objRS("id")%>" onclick="showHide1('<%=objRS("id")%>'); return false"  onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="images1/arrows5.gif" width="17" height="17"></a> <%=objRS("activities_title")%>  </div>
        <div id="answer1_<%=objRS("id")%>" class="answers1"><%=objRS("activities")%></div>
        <div id="question2_<%=objRS("id")%>"><a href="#" id="lnk2_<%=objRS("id")%>" onclick="showHide2('<%=objRS("id")%>'); return false"  onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="http://images1/arrows5.gif" width="17" height="17"></a> <%=objRS("reflect_title")%>  </div>
        <div id="answer2_<%=objRS("id")%>" class="answers2"><%=objRS("reflect")%></div>
        <div id="question3_<%=objRS("id")%>"><a href="#" id="lnk3_<%=objRS("id")%>" onclick="showHide3('<%=objRS("id")%>'); return false"  onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="http:///arrows5.gif" width="17" height="17"></a> <%=objRS("tools_title")%>  </div>
        <div id="answer3_<%=objRS("id")%>" class="answers3"><%=objRS("tools")%></div><br>
     </div>
        </td><td width="60%" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" valign="top">
            <td height="80" valign="top"><div class="latestcontain1">Location: The Stories </div> 
              <table width="100%" border="0" cellpadding="0" cellspacing="0">

  • #5
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes i did and i do get "no records found"

    I tried this too
    Code:
    if   (objRS.EOF and objRS.BOF) then
    	response.write  "<tr><td>No records found</td></tr>"
    	end if


  •  

    Posting Permissions

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