[thelist] VBScript Question about Empty and Nothing

Philip Raymond philip at papaquack.com
Thu Nov 1 09:03:43 CST 2001

OK... I've got a question, and this will probably show my ignorance on the
subject, but here goes anyway.  :-)  When setting a variable to Nothing
after using it as an object, is it necessary (or good programming practice)
to set the variable to Empty, as in the following code?

Dim myVar
Set myVar = Server.CreateObject("ADODB.Recordset")
Set myVar = Nothing
myVar = Empty

The reason I ask is because recently I've noticed when debugging some of my
pages in Visual Interdev that after I set the variable to Nothing, it's
still an object with a value of Nothing, and running IsObject(myVar) is
still True.  The object type doesn't seem to go away until declare the
variable as Empty.

Is declaring the variable as Empty something I should be doing, or does it
really matter?  Also, a related question, if I Dim a variable in a procedure
and use it, should I declare that variable as Empty at the end of the
procedure, or does it really matter either?

Thank you so much for your help.  Have a GREAT day!!!

Philip Raymond

More information about the thelist mailing list