Hello Guys:

I was wondering if you notice anything wrong with this code?  This Sub is called at 
the end of every page to destroy any object that was created.  However:  I don't think 
it works.  I can't seem to understand where the (obj) is being found (as there is 
never any values passed into the sub, and the obj is not declared on the page level.  

It seems like it should work to clean up any recordsets, as they are declared on the 
page as RS or RS2 (but if there is a recordset that is not declared as RS or RS2, then 
this should not work).

There are a bunch of classes being created and a bunch of other objects like XML 
objects that do not have a name declared as obj or valid, so none of these should be 
destroyed, should they?

Thanks for any help you may be able to provide.
Andy

--------------------------------------------------------------------------------

<%
  sub cleanUpAll()
    dim debugStr
    if len(request("cleanUpDebug")) = 1 then session("cleanUpDebug") = 
request("cleanUpDebug")
    if session("cleanUpDebug") = "1" then
      debugStr = "<b><div>" & Request.ServerVariables("SCRIPT_NAME") & "</div><div>" & 
now() & "</div></b>"
      if isObject(myConn) then debugStr = debugStr & "<div>myConn = " & (not myConn is 
nothing) & " --> <myConn></div>"
      if isObject(rs)     then debugStr = debugStr & "<div>rs = " & (not rs is 
nothing) & " --> <rs></div>"
      if isObject(rs2)    then debugStr = debugStr & "<div>rs2 = " & (not rs2 is 
nothing) & " --> <rs2></div>"
      if isObject(obj)    then debugStr = debugStr & "<div>obj = " & (not obj is 
nothing) & " --> <obj></div>"
      if isObject(valid)  then debugStr = debugStr & "<div>valid = " & (not valid is 
nothing) & " --> <valid></div>"
    end if
    call cleanUpRs(myConn)
    call cleanUpRs(rs)
    call cleanUpRs(rs2)
    call cleanUp(obj)
    call cleanUp(valid)
    if session("cleanUpDebug") = "1" then
      if isObject(myConn) then debugStr = replace(debugStr, "<myConn>", (not myConn is 
nothing))
      if isObject(rs)     then debugStr = replace(debugStr, "<rs>", (not rs is 
nothing))
      if isObject(rs2)    then debugStr = replace(debugStr, "<rs2>", (not rs2 is 
nothing))
      if isObject(obj)    then debugStr = replace(debugStr, "<obj>", (not obj is 
nothing))
      if isObject(valid)  then debugStr = replace(debugStr, "<valid>", (not valid is 
nothing))
      debugStr = "<div style=""font-family:Tahoma; font-size:11px;"">" & debugStr & 
"</div>"
      %><script>
        var debugWin = window.open("", "cleanUpDebug", 
"width=250,height=250,resizable=yes,scrollbars=yes");
        debugWin.document.write("<%= replace(debugStr, """", "\""") %>");
        //debugWin.focus();
      </script><%
    end if
  end sub

  sub cleanUp(ByRef objItem)
    if IsObject(objItem) then
      if not objItem is Nothing Then
        set objItem = Nothing
      end if
    end if
  end sub

  sub cleanUpRs(ByRef objItem)
    if IsObject(objItem) then
      if not objItem is Nothing Then
        if objItem.state <> 0 then
          objItem.close
        end if
        set objItem = Nothing
      end if
    end if
  end sub
%>



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/17folB/TM
---------------------------------------------------------------------~->

---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [EMAIL PROTECTED]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 

Reply via email to