Recordset error

Author Message
vir0077

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 1/16/2011
  • Status: offline
Recordset error Sunday, January 16, 2011 11:04 AM (permalink)
0
I am new to asp. Using windows 7 + dreamweaver cs3.
I have small stationery website for coursework at uni. I created home page (default.asp), which has a dynamic drop down menu for products. The menu is displayed via include file catList.asp (see script below)
<%
Set catRS = Server.CreateObject( "ADODB.Recordset" )
catRS.ActiveConnection = Con
sqlString = "SELECT DISTINCT category FROM Product "
sqlString = sqlString & "WHERE status=1 "
sqlString = sqlString & "ORDER BY category"
catRS.Open sqlString
%>

<script language="JavaScript" type="text/javascript">
function loadPage(list)
{
location.href=list.options[list.selectedIndex].value
}
</script><title>My-stationer</title>
<form style="padding-left:6px" action="">
<select name="choice" size="1"
onchange="loadPage(this.form.elements[0])"
onmouseclick="this.focus()" >

<option>Select Category</option>
<% WHILE NOT catRS.EOF %>
<option value="default.asp?cat=<%=Server.URLEncode( catRS( "category" ) )%>"> <%=catRS( "category") %> </option>
<%
catRS.MoveNext
WEND
%>
</option>
</select>
</form>
I also created a shopping cart using session variable. I would like to keep the drop down menu on the left side of my cart page, but I get error:
ADODB.Recordset error ‘800a0bb9’
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/vir0077/coursework2/my-stationer/catList.asp, line 3 (this is the drop down menu file)
 
Can anyone tell me how to fix this? Otherwise I have to get rid of the drop down menu for the cart page, but all other pages have it..
 
V
 
#1
    TheQuestor

    • Total Posts : 5
    • Scores: 0
    • Reward points : 0
    • Joined: 1/18/2011
    • Status: offline
    Re:Recordset error Tuesday, January 18, 2011 1:12 AM (permalink)
    0
    I thing you would have much better luck not using client side to try to talk to server side in this case
    something along the lines of
     
    DataString = "Driver={SQL Server};Server="&ServerString&";Database="&DBString&";Uid="&UIDString&";Pwd="&PwdString&";CommandTimeout=320;"
    Set adoCon = Server.CreateObject("ADODB.Connection")
    adoCon.Open DataString Set rsPopDrop = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT DISTINCT [category] FROM Product " 
    rsPopDrop.Open strSQL, adoCon%>
    <form name="GetProduct" method="post" action="[SomethingHere]">
    <select name="choice" onChange="document.[SomethingHere].submit()">
    <option value="">Select Category</option> <%do Until rsPopDrop.EOF
    choice = rsPopDrop("category")
    %><option value="<%=choice%>"><%=choice%></option><%
    rsPopDrop.movenext
    Loop
    %></form><%
    rsPopDrop.Close
    Set rsPopDrop = Nothing
    adoCon.Close set adoCon = Nothing %>
     
    
     
    would do you better with less code to bork on you later :)
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9