?
Solved

Check if Object Variable has been Set to Nothing

Posted on 2005-03-22
5
Medium Priority
?
246 Views
Last Modified: 2012-05-05
Is there any way to check if an object variable was set to Nothing?
0
Comment
Question by:HangTenDesign
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 13601780
try:

<%

if obj is nothing then
  response.write "obj is nothing"
else
  response.write "obj is not nothing"
end if

%>
0
 
LVL 33

Accepted Solution

by:
hongjun earned 500 total points
ID: 13601807
Simple example

<%
Dim conn

Set conn = CreateObject("ADODB.Connection")

If IsObject(conn) Then
    Response.Write "Is object<br>"
    If conn Is Nothing Then
        Response.Write "Nothing<br>"
    Else
        Response.Write "Not Nothing<br>"
    End If
Else
    Response.Write "Is Not object<br>"
End If

Set conn = Nothing

If IsObject(conn) Then
    Response.Write "Is object<br>"
    If conn Is Nothing Then
        Response.Write "Nothing<br>"
    Else
        Response.Write "Not Nothing<br>"
    End If
Else
    Response.Write "Is Not object<br>"
End If
%>


hongjun
0
 

Author Comment

by:HangTenDesign
ID: 13601816
I found a really good snippet at FourGuys... http://www.4guysfromrolla.com/webtech/tips/t021000-1.shtml
0
 
LVL 33

Expert Comment

by:hongjun
ID: 13601823
oops!!!
a bit duplicated posting.
0
 
LVL 33

Expert Comment

by:hongjun
ID: 13602079
ryancys,

    your deserved points here http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21360178.html

hongjun
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question