Either BOF or EOF on Multiple Select List Box


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
Who is Participating?

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??

garethtnashAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.