How do I fix this error message ADODB.Field error '800a0bcd' Either BOF or EOF is True

Posted on 2005-04-11
Last Modified: 2007-12-19
ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/www/downloads/ftn/trainingschedule/trainemail.asp, line 75

here is the code for the page line 75 has this tag --ERROR--

<% 'option explicit %>
Response.CacheControl = "no-cache"

<!--#include virtual = "/www/downloads/jjd/Utils/File_IO.asp"-->
<!--#INCLUDE virtual = "/www/downloads/jjd/Utils/adovbs.asp"-->
<!--#Include virtual = "/www/downloads/jjd/secure/DataInfo.asp" -->
<!--#Include virtual = "/www/Include/UsgInclude.asp" -->
<!--#Include virtual = "/www/downloads/jjd/Utils/SendEmail.asp" -->

  'Declare local variables that will be used on this screen
  DIM rc, strquery
  DIM rsMain, strMark
  DIM stremployeename, strCoursename
  DIM strstartdate, strstarttime, strcoursedescription
  DIM szLogMsg, szLogMsgEnd
  DIM mail, strEmailMsg

  ' Create and Open a recordset to the SQL database tables  

Set rsMain = Server.CreateObject("ADODB.Recordset")
strquery = "SELECT *  FROM vw_training_leader_email_data (nolock) WHERE EEID = '" &  strEEID  & "' and classID = '" & strclassId & "' ; "
rsMain.Open strQuery,strConnectFtnWeb,adOpenKeyset,adLockReadOnly,adCmdText

'stremployeename = rsMain("EmployeeName")
'strCoursename = rsMain("CourseName")
'strstartdate = rsMain("StartDate")
'strstarttime = rsMain("StartTime")
'strcoursedescription = rsMain("CourseDescription")

' Prepare Manager Email Message
szLogMsg = ""

szLogMsg = szLogMsg & "<HTML>"
szLogMsg = szLogMsg & "<HEAD></HEAD>"
szLogMsg = szLogMsg & "<BODY><DIV><FONT size=3>"
--ERROR HERE -- szLogMsg = szLogMsg & "<FONT face=Arial><u> " & rsMain("employeeName").Value & "</U></FONT>"
szLogMsg = szLogMsg & "has enrolled in the <U>"  
szLogMsg = szLogMsg & "rsMain('CourseName') &"
szLogMsg = szLogMsg & "</U> class that will be held on &nbsp;<EM><u>"
szLogMsg = szLogMsg & "rsMain('StartDate') &"
szLogMsg = szLogMsg & "</U></EM> at <U>"
szLogMsg = szLogMsg & "rsMain('StartTime') &"
szLogMsg = szLogMsg & "</U>.&nbsp; <o:p></o:p></FONT>"
szLogMsg = szLogMsg & "<P><FONT size=3><U>"
szLogMsg = szLogMsg & "rsMain('Coursename') &"
szLogMsg = szLogMsg & "</U>is:</FONT></P><P><FONT size=3>"
szLogMsg = szLogMsg & "rsMain('CourseDescription') &"
szLogMsg = szLogMsg & "</FONT></P>"
szLogMsg = szLogMsg & "<FONT size=3>You do not need to take any further action, if this meets your approval.</FONT>"
szLogMsg = szLogMsg & "<FONT size=3>&nbsp;</FONT>"
szLogMsg = szLogMsg & "<FONT size=3>However, if you would like this enrollment canceled or another date/time chosen, please click here to view the Frequently Asked Questions on the Training Web site. </FONT>"
szLogMsg = szLogMsg & "<FONT size=3> <br><br>Thanks, </FONT>"
szLogMsg = szLogMsg & "<FONT size=3>Total Comp</FONT></P></FONT></DIV><br>"
szLogMsg = szLogMsg & "</BODY></HTML>"

szLogMsgEnd = ""

' Append Feedback info to the ManagerEmail Log file

DIM szFile
szFile = "ManagerEmail_" & Year(Date) & "-" & Month(Date) & ".log"
rc = AppendToFile (szFile, szLogMsg & szLogMsgEnd)

'If error, set up error message information to pass to the error webpage
if (rc <> 0) then

      Session("ErrorOnFormName")      = "My Stuff - Employee Training Signup"
      Session("ErrorNumber")            = rc
      Session("ErrorDescription")      = ""
      Session("ErrorSource")            = "Error on AppendToFile"

      Response.Redirect ("emailerror.asp")

end if

' Email Manager

szMark = "  |  "

dim strTo, strCc, strBcc, strFrom, strSubject, strMessage, strAttachment, strResults

  strTo         = ""
  strCc         = ""
  strBcc        = ""
  strFrom       = "TotalComp@jjd
  strSubject    = "My"
  strMessage    = szLogMsg
  strAttachment = ""

  strResults    = SendEmailMsg(strTo, strCC, strBcc, strFrom, strSubject, strMessage, fSendMsgAsHTML, strAttachment)

  If strResults(0) <> 0 Then

      szErrorMsg = Date & szMark & Time & szMark & strResults(0) & szMark & " Email Not Sent to " & strTo & szMark & strResults(1)
      AppendToFile "ManagerEmail.log", szErrorMsg

      Session("ErrorOnFormName")      = "My"
      Session("ErrorNumber")            = strResults(0)
      Session("ErrorDescription")      = ""
      Session("ErrorSource")            = szErrorMsg

End If

set rsmain = nothing

Question by:MrJarvis2004
    LVL 2

    Expert Comment

    seems like your recordset is not returning any records. check the query in the backend.

    put conditions like rsMain.EOF=False and then do the concatinations.

    Try it.!

    LVL 12

    Expert Comment

    when you do a select query, you should to check for the condition whether your query returns any record first:

    rsMain.Open strQuery,strConnectFtnWeb,adOpenKeyset,adLockReadOnly,adCmdText

    if not rsMain.EOF then

      stremployeename = rsMain("EmployeeName")
      strCoursename = rsMain("CourseName")
      strstartdate = rsMain("StartDate")
      strstarttime = rsMain("StartTime")
      strcoursedescription = rsMain("CourseDescription")
    else   'eof (no record)
       response.write("<p>No Record returned</p>")
    end if

    Author Comment

    My results is saying no records found but the query works in the backend.
    LVL 9

    Expert Comment

    You can also put an on error resume next. This will allow you to jump over little errors like this. However you then have to put in some error checking in places that may require authentication.
    LVL 13

    Expert Comment

    you must use rsMain.MoveNext() whenever you're trying to pull a row/record from the recordset, that's why you're getting this error

    Do Until rsMain.EOF
    LVL 13

    Expert Comment

    what are you trying to do..? how do you want results to be displayed..?
    LVL 14

    Accepted Solution

    I'll just comment on all I see at a quick glance.  Hope you find it helpful...

    If you're going to use recordset looping, which I try to discourage, then you should test first and also move to the first record.


    If Not rsMain.BOF and Not rsMain.EOF Then
    end if

    String concatenation is processor intensive and slow.
    Open connections late and close early.  Recordset looping doesn't do that. getRows is a better alternative.
    Buffering your page will give you better performance.
    Use Response.Buffer right after Option Explicit - Not sure why you have it commented out.  It helps during debugging.
    CSS is better than deprecated HTML markup.
    It is better to DIM multiple variables on one line than single ones per line.
    Dim var1, var2, var3
    Dim var1
    Dim var2
    Dim var3
    Organize your code and dim all public variables in one area and all private variables in one area.
    Dim pubVar1, pubVar2, pubVar3
    ' code follows

    instead of

    Dim pubVar1

    ' code follows

    Dim pubVar2

    ' more code follows

    Use subs/functions when possible as well as private variables over public, when possible.
    Always clear object variables.  I never saw this closed: strConnectFtnWeb
    LVL 14

    Expert Comment

    Thank you Mr. Jarvis.  (O:=

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Suggested Solutions

    Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    This video discusses moving either the default database or any database to a new volume.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now