-
Dec 2nd, 2021, 04:46 PM
#1
Thread Starter
New Member
Recordset closure error.
This is the 2nd time I have posted, not sure what happened to the first one?
I have a very simple file "closeconnection-process.asp. I insert it using #include and it is to close the recordset (rs) and the connection (Conn) and also to empty the variable values to restore space>
This is the simple code in the file:
<%
rs.close
Conn.close
Set rs = Nothing
Set Conn = Nothing
%>
This is the #include statement:
<!--#include virtual = "process/closeconnection-process.asp"-->
and this the error I continue to receive:
Microsoft VBScript runtime error '800a01a8'
Object required
/process/closeconnection-process.asp, line 6
Line 6 is the first code line (rs.close) (I have 5 blank lines) I know it is going to be either very simple or will be so convoluted that a fix will never be identified.
Thanks
dg
-
Dec 2nd, 2021, 06:01 PM
#2
Re: Recordset closure error.
Welcome to VBForums
Originally Posted by 7Iron
This is the 2nd time I have posted, not sure what happened to the first one?
We have anti-spam measures here, including a system that means some posts from new users are temporarily hidden until they are checked by a moderator - your first post was one of those.
I have removed the duplicate.
and this the error I continue to receive:
Microsoft VBScript runtime error '800a01a8'
Object required
/process/closeconnection-process.asp, line 6
Line 6 is the first code line (rs.close) (I have 5 blank lines) I know it is going to be either very simple or will be so convoluted that a fix will never be identified.
That implies rs does not have any value (or perhaps not even exist) at the time the code runs.
My experience with .asp pages is too far in the past to think why that might be, so I can only really suggest checking the order of the code to make sure the #include will be after rs is set up
-
Dec 3rd, 2021, 08:36 AM
#3
Thread Starter
New Member
Re: Recordset closure error.
Thank you,
And your assessment was spot on. I had the "close" process #include statement in my page two times. The 2nd one could not find a "rs" to close as it had already been closed
Great call
dg
-
Dec 3rd, 2021, 09:14 AM
#4
Re: Recordset closure error.
Originally Posted by 7Iron
Thank you,
And your assessment was spot on. I had the "close" process #include statement in my page two times. The 2nd one could not find a "rs" to close as it had already been closed
Great call
dg
It's not that it had been closed, it's that it was Nothing. You can't call methods on objects that are Nothing. Since you had explicitly set the variable to Nothing during the first include, the second time around, when you call the .Close, it errors out because it doesn't exist any more. If it had simply been closed, but not set to Nothing, then calling .Close a second time wouldn't have had any effect.
-tg
-
Dec 3rd, 2021, 09:21 AM
#5
Thread Starter
New Member
Re: Recordset closure error.
Yes techgnome, thank you for the clarification and I understand the nuance....had I not set it to nothing , then I am not sure what error if any I would have recieved, but if I did a "reponse.write rs" then it would have return the value stored in rs. but since I had already closed and cleared (set to nothing) I received the error msg..
That is not a trivial distinction and I thank you for it....I am old but learning , just a lot slower than I once could have.
thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|