Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Convert::IsDBNull Method (Object^)

 

Returns an indication whether the specified object is of type DBNull.

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

public:
static bool IsDBNull(
	Object^ value
)

Parameters

value
Type: System::Object^

An object.

Return Value

Type: System::Boolean

true if value is of type DBNull; otherwise, false.

The IsDBNull method tests whether the value parameter is equal to DBNull::Value. It is equivalent to the following code:

No code example is currently available or this language may not be supported.
System_CAPS_noteNote

DBNull::Value is used to indicate a value that is missing. It is not equivalent to null or to String::Empty. Therefore, code such as Convert.IsDBNull(null) in C# or Convert.IsDBNull(Nothing) in Visual Basic returnsfalse.

The following example uses a SqlDataReader object to retrieve survey data from a database. It assigns each row's field values to an array, and then passes each array element to the IsDBNull method. If the method returns true, the example assigns the string "NA" to the array element. The array is then added to the Rows collection of a System.Windows.Forms::DataGridView control.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2017 Microsoft