Either BOF or EOF on Multiple Select List Box

Posted on 2011-10-18
Last Modified: 2012-05-12

I have a multiple list select box which is on an edit page.

The list box should list all possible selections and if any of these are already selected, highlight the selected choices...

But IF none are selected - Just show the possible selections..

At the moment I'm getting the following error On a page where no selections have been made  -

" ADODB.Recordset error '800a0bcd'

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

../formfields/Update-Product/RelatedProducts.asp, line 2"

my code from RelatedProducts.asp is below -

arrRelated = RsRelated.GetRows()   '-- this'll put the recordset into an array
<select name="related" size="4" multiple="multiple" id="related" class="menulist" >
While (NOT RsRelatedProductOptions.EOF)
%><option value="<%=(RsRelatedProductOptions.Fields.Item("ID").Value)%>"<%    
        for each productID in arrRelated
            If (productID <> "" ) Then
                If ( CStr(RsRelatedProductOptions.Fields.Item("ID").Value) = CStr( productID ) ) Then
                    Response.Write(" selected=""selected""")
                end if
            End if        

Open in new window

My recordset is called using an SP but inthis instance the recordset is empty -


Dim CMDRsRelated__ID
CMDRsRelated__ID = "0"
if(Request("ID") <> "") then CMDRsRelated__ID = Request("ID")

  set CMDRsRelated = Server.CreateObject("ADODB.Command")
  CMDRsRelated.ActiveConnection = MM_Connection_STRING
  CMDRsRelated.CommandText = "dbo.AdminSelectProductRelatedProducts"
  CMDRsRelated.CommandType = 4
  CMDRsRelated.CommandTimeout = 0
  CMDRsRelated.Prepared = true
  CMDRsRelated.Parameters.Append CMDRsRelated.CreateParameter("@RETURN_VALUE", 3, 4)
  CMDRsRelated.Parameters.Append CMDRsRelated.CreateParameter("@ID", 3, 1,8,CMDRsRelated__ID)
  set RsRelated = CMDRsRelated.Execute
  RsRelated_numRows = 0

Open in new window

Please can you help highlight what I've done wrong..

Thank you
Question by:garethtnash
    LVL 8

    Accepted Solution


    This error is telling you that you query is returning 0 results, so it can't create an array with nothing, I don't normally use the commands you've used to do this kind of thing so I'd like to question this
    RsRelated_numRows = 0

    Open in new window

    seeing this made me think your asking it to return 0 rows??


    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 Mobile App Development with PhoneGap

    PhoneGap can help you leverage your already existing HTML5, JavaScript, and CSS skills in order to create and deploy cross-platform mobile apps.This program comprehensively covers HTML5 mobile app development from top to bottom.

    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
    In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    759 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

    7 Experts available now in Live!

    Get 1:1 Help Now