Either BOF or EOF on Multiple Select List Box

Posted on 2011-10-18
Medium Priority
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

Accepted Solution

jawa29 earned 2000 total points
ID: 36987401

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

ID: 36991420

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

839 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