Results 1 to 5 of 5

Thread: Recordset closure error.

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2021
    Posts
    3

    Angry 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

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Recordset closure error.

    Welcome to VBForums

    Quote Originally Posted by 7Iron View Post
    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2021
    Posts
    3

    Thumbs up 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

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,531

    Re: Recordset closure error.

    Quote Originally Posted by 7Iron View Post
    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2021
    Posts
    3

    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
  •  



Click Here to Expand Forum to Full Width