Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Error: Object is closed (http://www.velocityreviews.com/forums/t800044-error-object-is-closed.html)

Eugene Anthony 11-17-2005 11:07 AM

Error: Object is closed
 
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

*** Sent via Developersdex http://www.developersdex.com ***

Bob Barrows [MVP] 11-17-2005 12:17 PM

Re: Error: Object is closed
 
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"




All times are GMT. The time now is 04:16 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.