Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking if object exists 1

Status
Not open for further replies.

CassidyHunt

IS-IT--Management
Jan 7, 2004
688
US
I have a class that I created in vbscript that I use to get results from the database. Sometimes I return no results or an empty object. How do I check that object to make sure it isn't empty? I have tried isnull and also seen if it = "" but neither work. Another key is they are all arrays. I tried seeing if the ubound of the array > 0 or 1 but no luck there I get an error for ubound on it.

I know I could just trap the error and move on but that seems to be the easy way out. Any other ideas?
 
oops...you mentioned that they are arrays...then this should work...

if UBound(myarray)=-1 then
'array is empty
else
'array has atleast one element
end if

-DNG
 
I used isempty and it works great. That was bone headed of me. I have done that before.

Thank you

CAssidy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top