This documentation is archived and is not being maintained.

DBNull Class

Represents a null value.

For a list of all members of this type, see DBNull Members.


[Visual Basic]
NotInheritable Public Class DBNull
   Implements ISerializable, IConvertible
public sealed class DBNull : ISerializable, IConvertible
public __gc __sealed class DBNull : public ISerializable,
class DBNull implements ISerializable, IConvertible

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.


This class is used to indicate the absence of a known value, typically in a database application.

In database applications, a null object is a valid value for a field. This class differentiates between a null value (a null object) and an uninitialized value (the DBNull.Value instance). For example, a table can have records with uninitialized fields. By default, these uninitialized fields have the DBNull value.

This class is also used in COM interop to distinguish between a VT_NULL variant, which is associated with a null object, and a VT_EMPTY variant, which is associated with the DBNull.Value instance.

DBNull is never equal to anything.

DBNull is a singleton class, which means only one instance of this class can exist. That sole instance is DBNull.Value.

Data intensive applications accessing SQL databases must use the System.Data.SqlTypes classes, which have inherent support for null values.


Namespace: System

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: Mscorlib (in Mscorlib.dll)

See Also

DBNull Members | System Namespace | Convert.DBNull | Convert.IsDBNull | System.Runtime.InteropServices.VarEnum | System.Data.SqlTypes