ASP code error with SQL server databases

A

Amit Kela

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 """>"
 
A

Aaron Bertrand - MVP

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top