Posts: 488
Name: Chip Johns
Location: Savannah Georgia
|
Hello asp friends. I have been busy busy learning asp. Have been too busy to frequent this form enough. In a few weeks things will be settling down and I will have time to search past posts and participate more. In the mean time is a little help possilbe? Please?
I am having trouble with the following error. My instincts are telling me that I do not need to close this connection, or that I have to do it in a different way? This is the code that I have used to close the connection and record set for other scripts that I am running for this (i.e., SELECT and UPDATE SQL Statememts.) The execution of the script works; The proper record is deleted from the database. The only thing is that after execution this page shows the error.
What do I need to do to get the script to finish without giving me this error?
Thanks! Chip
-------------------------------------
Error Type:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
/admin/deleteitem2.asp, line 28
**My CODE** (Lines just for Reference)
03 -
04 - <%
05 - Dim strTestif
06 - Dim strItem
07 - strTestif = TRIM(Request.FORM("Testif"))
08 - strItem = TRIM(Request.FORM("thisitem"))
09 - %>
10 -
11 - <%
12 - IF strTestif = 0 THEN
13 - %>
**Here is the script that is giving error**
14 - <%
15 - Dim objConnection, objRS, strQuery
16 - Dim strConnection
17 -
18 - set objConnection = Server.CreateObject("ADODB.Connection")
19 - strConnection = "Data Source=catalog1;"
20 - objConnection.Open strConnection
21 - Set objRS = Server.CreateObject("ADODB.Recordset")
22 - Set objRS.ActiveConnection = objConnection
22 -
23 - 'SQL RecordSet
24 - strQuery = "DELETE FROM Cat001 WHERE ItemID = "
25 - strQuery = strQuery & strItem
26 - objRS.Open strQuery
27 -
28 - objRS.Close
29 - objConnection.Close
30 - Set objRS = Nothing
31 - Set objConnection = Nothing
32 - %>
|