[thelist] checking for unclosed objects in ASP

Chris Blessing webguy at mail.rit.edu
Wed Oct 2 09:14:07 CDT 2002


Karen-

For connections specifically, you can do this:

if isObject(connObj) then
	if connObj.state <> 0 then
		' connObj is still busy, i.e. not adStateClosed

	end if
end if

For any object, you can check for its existance using isObject() and then
check the various properties associated with said object to determine if
it's open (if applicable) or not.  Recordsets for example:

if isObject(rsObj) then
	if rsObj.state <> 0 then
		' rsObj is still busy, i.e. not adStateClosed

	end if
end if

Actually, you can substitute any of these ADO objects in for rsObj/connObj:

Records
Recordsets
Connections
Streams
Commands

They all have the same state property available.

I can't remember specifically, but I believe VBScript (and VB for that
matter) don't do the whole "test the first conditional of an IF statement
and terminate the statement if it isn't true" thing or not, hence why I've
broken it into two IF statements (what is this called, btw?).  I'm pretty
sure VBS/VB will execute both conditionals regardless if the first is true
or not, so this might throw an error if the connObj doesn't exist:

if isObject(connObj) and connObj.state <> 0 then
	...
end if

HTH!

Chris Blessing
webguy at mail.rit.edu
http://www.330i.net

> Hi list,
>
> Is there any way to check for unclosed objects in ASP?
>
> When I'm debugging I often use Response.End, but I imagine this leaves
> everything open... I begin to notice performance degradation after a few
> page run throughs doing this.
>
> tia,
> Karen
> -------
> Miinx Design & Development
> e :: karen at miinx.com.au
> p :: 0413.880.302
> w :: www.miinx.com.au




More information about the thelist mailing list