ASP code error with SQL server databases

Discussion in 'ASP General' started by Amit Kela, Dec 2, 2003.

  1. Amit Kela

    Amit Kela Guest

    Hey,
    I am getting the following error when I try to delete the contents
    of a recordset under a condition statement. Is there any way I can
    delete them without running into this error?
    I need to delete the contents in the recordset 'rs' to delete the
    items from the shopping cart once the order is placed.
    Thanks, Amit

    Error Type:
    ADODB.Recordset (0x800A0CB3)
    Current Recordset does not support updating. This may be a limitation
    of the provider, or of the selected locktype.
    /FacLog/cartdisplay1.asp, line 370


    Relevant code:
    sql = "Select UserName,Code, Title From TempCartTable WHERE UserName=
    '" & strName & "' ORDER BY Code"
    set rs = db.execute(sql)

    if session ("OrderPlaced") = "true" then
    Response.Write " <div align = center> <font color=#FF0000><b>
    <h2> Your Cart is Presently Empty !!! </h2> <b> </font> <div>"
    end if

    ' Get all the Instructor Selections from TempCartTable
    if session ("OrderPlaced") = "false" then
    If not rs.eof Then
    'Response.Write rs("title")
    Response.Write "<h3> Database Requests </h3>"
    Response.Write "<br><table border='1'>"
    Response.Write "<tr> <td><div align=center><b> Remove
    </b></div></td> <td><div align=center><b> Code </b></div></td>
    <td><div align=center><b> Title </b></div></td> <td><div
    align=center><b> Course Details </b></div></td> <td><div
    align=center><b> Date Requested For </b></div></td><td><div
    align=center><b> Comments </b></div></td>"
    row=0

    while not rs.eof
    Response.write(flag)
    row=row+1

    Response.Write "<tr><td width='15'><a
    href='cartdisplay1.asp?Remove="
    Response.Write rs("Code")
    Response.Write "'><img src='/images/dot03.jpg'></a></td><td>"
    Response.Write rs("Code")
    Response.Write "</td>"
    Response.Write "<input type=hidden name='Code" & row
    Response.Write "' Value='"
    Response.Write rs("Code")
    Response.Write "'>"
    Response.Write "<td><a target=_parent href='FacMenuFS.html?Code="&
    rs("Code") & "'><font color='#006699'>"
    Response.Write rs("Title")
    Response.Write "</font></td> <div align=center><td>"
    Response.Write "<input type=hidden name=""Title" & row
    Response.Write """ Value=""" & Server.HtmlEncode(rs("Title"))
    Response.Write """>"
     
    Amit Kela, Dec 2, 2003
    #1
    1. Advertising

  2. Use a DELETE statement to affect data.

    conn.execute "DELETE table WHERE key=" & key,,129

    Not only does it avoid the problem you're having, it is also more efficient.

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/




    "Amit Kela" <> wrote in message
    news:...
    > Hey,
    > I am getting the following error when I try to delete the contents
    > of a recordset under a condition statement. Is there any way I can
    > delete them without running into this error?
    > I need to delete the contents in the recordset 'rs' to delete the
    > items from the shopping cart once the order is placed.
    > Thanks, Amit
    >
    > Error Type:
    > ADODB.Recordset (0x800A0CB3)
    > Current Recordset does not support updating. This may be a limitation
    > of the provider, or of the selected locktype.
    > /FacLog/cartdisplay1.asp, line 370
    >
    >
    > Relevant code:
    > sql = "Select UserName,Code, Title From TempCartTable WHERE UserName=
    > '" & strName & "' ORDER BY Code"
    > set rs = db.execute(sql)
    >
    > if session ("OrderPlaced") = "true" then
    > Response.Write " <div align = center> <font color=#FF0000><b>
    > <h2> Your Cart is Presently Empty !!! </h2> <b> </font> <div>"
    > end if
    >
    > ' Get all the Instructor Selections from TempCartTable
    > if session ("OrderPlaced") = "false" then
    > If not rs.eof Then
    > 'Response.Write rs("title")
    > Response.Write "<h3> Database Requests </h3>"
    > Response.Write "<br><table border='1'>"
    > Response.Write "<tr> <td><div align=center><b> Remove
    > </b></div></td> <td><div align=center><b> Code </b></div></td>
    > <td><div align=center><b> Title </b></div></td> <td><div
    > align=center><b> Course Details </b></div></td> <td><div
    > align=center><b> Date Requested For </b></div></td><td><div
    > align=center><b> Comments </b></div></td>"
    > row=0
    >
    > while not rs.eof
    > Response.write(flag)
    > row=row+1
    >
    > Response.Write "<tr><td width='15'><a
    > href='cartdisplay1.asp?Remove="
    > Response.Write rs("Code")
    > Response.Write "'><img src='/images/dot03.jpg'></a></td><td>"
    > Response.Write rs("Code")
    > Response.Write "</td>"
    > Response.Write "<input type=hidden name='Code" & row
    > Response.Write "' Value='"
    > Response.Write rs("Code")
    > Response.Write "'>"
    > Response.Write "<td><a target=_parent href='FacMenuFS.html?Code="&
    > rs("Code") & "'><font color='#006699'>"
    > Response.Write rs("Title")
    > Response.Write "</font></td> <div align=center><td>"
    > Response.Write "<input type=hidden name=""Title" & row
    > Response.Write """ Value=""" & Server.HtmlEncode(rs("Title"))
    > Response.Write """>"
     
    Aaron Bertrand - MVP, Dec 2, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DKode
    Replies:
    3
    Views:
    683
    =?Utf-8?B?RGF2ZQ==?=
    Apr 29, 2005
  2. Oenone
    Replies:
    7
    Views:
    1,033
    Oenone
    Jul 11, 2005
  3. Erik Funkenbusch
    Replies:
    2
    Views:
    1,936
    Ken Cox - Microsoft MVP
    Mar 26, 2006
  4. Ken North
    Replies:
    0
    Views:
    633
    Ken North
    Jul 14, 2005
  5. John Davis
    Replies:
    2
    Views:
    142
    Curt_C [MVP]
    Aug 19, 2003
Loading...

Share This Page