Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > MS Technologies ( ASP, VB, C#, .NET )

Reply
 
LinkBack Thread Tools Display Modes
Old 10-29-2004, 02:26 PM   #1 (permalink)
helz
Registered User
 
helz's Avatar
 
Join Date: May 2004
Posts: 5
helz is on a distinguished road
ASP N00b - How to check if a variable is set? or empty?

hi, ive just recently started with ASP and was wondering what/if there is a way to see if a variable has been set. Either that or to check if a variable is empty?

thanks for any replies
helz is offline   Reply With Quote
Old 11-04-2004, 05:27 AM   #2 (permalink)
rdove
Masked Moderator
 
rdove's Avatar
 
Join Date: May 2002
Location: Indianapolis, IN
Posts: 260
rdove is on a distinguished road
You could do:

Code:
If var = "" Or IsNull(var) Then
  'Do Something
End If
__________________
~Ryan

rdove is offline   Reply With Quote
Old 11-04-2004, 06:00 AM   #3 (permalink)
helz
Registered User
 
helz's Avatar
 
Join Date: May 2004
Posts: 5
helz is on a distinguished road
is:
var = ""
the same as:
isEmpty(var)??
helz is offline   Reply With Quote
Old 11-04-2004, 10:19 AM   #4 (permalink)
rdove
Masked Moderator
 
rdove's Avatar
 
Join Date: May 2002
Location: Indianapolis, IN
Posts: 260
rdove is on a distinguished road
no

var = "" is closer to IsNull(var), but not the same.

IsEmpty is completely different.

var = ""
IsEmpty(var) - returns false

and

var = Empty
IsEmpty(var) - returns true

and

Dim var
IsEmpty(var) - returns true

IsEmpty:
http://msdn.microsoft.com/library/de...fctisempty.asp

IsNull:
http://msdn.microsoft.com/library/de...sfctisnull.asp

All vbscript functions:
http://msdn.microsoft.com/library/de...ifunctions.asp
__________________
~Ryan

rdove is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenGL.dll Mr.Anderson Platform/API C++ 3 08-13-2004 10:07 AM
check if session variable is null? sde Java 3 07-07-2004 12:27 PM


All times are GMT -8. The time now is 04:01 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting