rs.close problem..pls advice.

Results 1 to 8 of 8

Thread: rs.close problem..pls advice.

  1. #1
    Hendon again..:-) Guest

    Default rs.close problem..pls advice.

    Hello..<BR><BR>I type this every time I want to close a database I&#039ve used.<BR><BR>" rs.close <BR>set rs=nothing<BR>connect.close<BR>set connect=nothing"<BR><BR>I think that it&#039s the right way....but I got this message everytime I run the page :<BR><BR>"ADODB.Recordset error &#039 800a0e78&#039 <BR><BR>The operation requested by the application is not allowed if the object is closed. <BR><BR>/projeditrespond.asp, line 82"<BR><BR>..but if i skipped closing the recordset...meaning I omit "rs.close Set rs=nothing" ..it works, no error message...anyone can help..?<BR>I&#039m afraid that if i&#039m not able to close the database properly , I will have the *.ldb file opened always and it will lead to someother problems. Please advice.<BR><BR>Thanking you in advance.

  2. #2
    Join Date
    Dec 1969
    Posts
    5

    Default RE: rs.close problem..pls advice.

    hai<BR>firstly i could&#039nt understand why did u use the statement<BR>set rs=nothing,try without giving this. b&#039cos i don&#039t specify this it works out fine.do u have any specific reason to use this statement, then let me know?<BR>it&#039s only a suggestion.

  3. #3
    Join Date
    Dec 1969
    Posts
    5

    Default RE: rs.close problem..pls advice.

    hai<BR>firstly i could&#039nt understand why did u use the statement<BR>set rs=nothing,try without giving this. b&#039cos i don&#039t specify this it works out fine.do u have any specific reason to use this statement, then let me know?<BR>it&#039s only a suggestion.

  4. #4
    Vidya Guest

    Default RE: rs.close problem..pls advice.

    Hi,<BR>U must first set the recordset or connection object to nothing and then close it. If u try to close the objects and then try to set it to nothing ( as in ur code), u&#039ll get this error as u are trying to access the recordset and connection object after they are being closed.<BR><BR>Hence i suggest u try changing the code.<BR>i.e set rs = nothing.<BR>rs.close..<BR><BR>Similarly for connection object


  5. #5
    Join Date
    Dec 1969
    Posts
    1,671

    Default RE: rs.close problem..pls advice.

    actually your are on the right track but it&#039s just the opposite. Once you set an object to nothing you can&#039t access it. So the above code is trying to call the Close method on an object that doesn&#039t exist. The original code was right...<BR><BR>rs.Close<BR>set rs = Nothing<BR>

  6. #6
    Join Date
    Dec 1969
    Posts
    1,671

    Default RE: rs.close problem..pls advice.

    This is the correct code. It sounds like your rs isn&#039t being opened. Are you sure the code to open the recordset is being called?<BR><BR>Either:<BR><BR>rs.Open "select * from table", connect<BR><BR>OR<BR><BR>set rs = connect.Execute("select * from table")<BR><BR>NEEDS to happen before you call rs.Close.<BR><BR>Good luck! ;)

  7. #7
    Join Date
    Dec 1969
    Posts
    2,493

    Default RE: rs.close problem..pls advice.

    I use that code at the end of every asp page and never have a problem unless I have previously close the recordset or connection somewhere else.

  8. #8
    Vikas Nigam Guest

    Default RE: rs.close problem..pls advice.

    hi,<BR>You are trying to access some field of the RS after it has been closed.... Pl check the loop....close the RS after the loop....<BR>Rs.Close<BR>Set RS=Nothing<BR>I m sure it will correct ya problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •