Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Error: Object is closed

Reply
Thread Tools

Error: Object is closed

 
 
Eugene Anthony
Guest
Posts: n/a
 
      11-17-2005
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 (0x800A0E7
Operation is not allowed when the object is closed.


How do I solve the problem.


Your help is kindly appreciated.


Eugene Anthony

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      11-17-2005
Eugene Anthony wrote:
> 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()



--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
Reply

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
asp to asp.net operation not allowed when object is closed amitbadgi@gmail.com ASP .Net 1 08-10-2005 11:36 AM
sp_executesql Operation is not allowed when the object is closed cliverama ASP General 1 11-05-2003 01:03 PM
Error "Operation is not allowed when the object is closed" Matthew Louden ASP General 6 09-28-2003 02:26 AM
Opera - .closed not accessible if window is closed? Matt Kruse Javascript 5 09-09-2003 01:27 AM



Advertisments