IsDBNull Function


IsDBNull Function

Class

Microsoft.VisualBasic.Information

Syntax

     Dim result As Boolean = IsDBNull(expression) 


expression (required; any)

The expression to be evaluated against System.DBNull

Description

The IsDBNull function determines whether expression evaluates to System.DbNull (true) or not (False).

Usage at a Glance

  • DbNull is not the same as Nothing or an empty string. DbNull is used to denote a missing or nonexistent value, and it is used primarily in the context of database field values.

  • Because of the way that VB deals with expressions containing DBNull, you cannot simply compare a variable to DBNull, as in:

         If (someVariable = DbNull) Then 

    You must make the comparison using the IsDbNull function.

         If (IsDBNull(someVariable) = True) Then 

Version Differences

  • The IsDBNull function is new with VB under .NET.

  • Visual Basic 2005 includes a new IsNullOrEmpty method as part of the String data type that may better meet your needs.




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net