Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 09:54 AM
Amit Kela
Guest
 
Posts: n/a
Default ASP code error with SQL server databases

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 """>"
  #2  
Old July 19th, 2005, 09:54 AM
Aaron Bertrand - MVP
Guest
 
Posts: n/a
Default Re: ASP code error with SQL server databases

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" <amit.kela@colorado.edu> wrote in message
news:8e5e432b.0312021441.28565883@posting.google.c om...[color=blue]
> 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 """>"[/color]


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles