Link to home
Start Free TrialLog in
Avatar of garethtnash
garethtnashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Either BOF or EOF on Multiple Select List Box

Help..

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        
         next     
       %>><%=(RsRelatedProductOptions.Fields.Item("Product-Name").Value)%></option>
	   <%
 
  RsRelatedProductOptions.MoveNext()
Wend
%></select>

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
ASKER CERTIFIED SOLUTION
Avatar of jawa29
jawa29
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of garethtnash

ASKER

thanks