Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 29th, 2010, 02:16 PM
Registered User
 
Join Date: Jan 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Operation is not allowed when the object is closed.

Good afternoon.

IIS 6.0. DB was created with MSO 2003, though we are now using MSO 2007.

Using vbscript, and getting the following error.

ADODB.Recordset error '800a0e78' Operation is not allowed when the object is closed.

Code:
GuestCheckout VisitsID

Sub GuestCheckout(x)
    Dim cnn, rs, strSQL
    Set cnn = Server.CreateObject("ADODB.Connection")
    Set rs = Server.CreateObject("ADODB.Recordset")
    Call cnn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../list.mdb"))
    strSQL = "UPDATE visits SET CheckoutDate = '" & now() & "' WHERE [visits.id] = " & x & ""
    x = ""
    rs.Open strSQL, cnn
    rs.Close() <--- THIS IS THE ERROR LINE
    Set rs = Nothing
End Sub
I am running into this a lot. I open a rs, use it and post some data, then try and close it but am told the object is closed. If I try and re-open the same rs with a different query I am told I can not use the object. Ideas?
 
Old January 29th, 2010, 03:30 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Don't use Open as your query doesn't return any results. Use Execute instead:

http://www.w3schools.com/ADO/met_comm_execute.asp

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 29th, 2010, 05:29 PM
Registered User
 
Join Date: Jan 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thank you!

Quote:
Originally Posted by Imar View Post
Hi there,

Don't use Open as your query doesn't return any results. Use Execute instead:

http://www.w3schools.com/ADO/met_comm_execute.asp

Hope this helps,

Imar
Perfect, thank you!





Similar Threads
Thread Thread Starter Forum Replies Last Post
ADODB.Recordset error '800a0e78' Operation is not allowed when the object is closed. laoclondon Classic ASP Basics 6 June 8th, 2009 10:01 PM
Operation is not allowed when the object is closed lightmaker Classic ASP Basics 1 June 6th, 2008 12:29 PM
Operation is not allowed when the object is closed kingroon Classic ASP Databases 2 February 5th, 2008 10:29 AM
Operation is not allowed when the object is closed kah Javascript How-To 2 February 16th, 2005 07:20 AM
operation is not allowed when object is closed shoakat Classic ASP Databases 1 November 26th, 2004 12:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.