Error: Object is closed

E

Eugene Anthony

ASP code to delete a record:

openDB()

Set rs = Server.CreateObject("ADODB.Recordset")
objConn.usp_deleteOptions OptionID,rs

closeRS()
closeDB()



MS SQL Stored Procedure:


create procedure usp_deleteOptions
@OptionID int
AS SET NOCOUNT ON

DELETE FROM Options WHERE OptionID=@OptionID

Return
GO



Problem:

When I try to delete a record I get this error:

Error Type:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.


How do I solve the problem.


Your help is kindly appreciated.


Eugene Anthony
 
B

Bob Barrows [MVP]

Eugene said:
ASP code to delete a record:

openDB()

Set rs = Server.CreateObject("ADODB.Recordset")
objConn.usp_deleteOptions OptionID,rs

closeRS()
closeDB()
Why are you creating an expensive recordset to run a query/procedure that
does not return records??
Change the code to:
openDB()

objConn.usp_deleteOptions OptionID

closeRS()
closeDB()
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top