DBNull Class

Represents a null value.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public sealed class DBNull : ISerializable, IConvertible
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public final class DBNull implements ISerializable, IConvertible
public final class DBNull implements ISerializable, IConvertible

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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions