DataReaderExtensions.IsDBNull(DbDataReader, String) Method

Definition

Gets a value that indicates whether the column contains nonexistent or missing values.

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsDBNull(System::Data::Common::DbDataReader ^ reader, System::String ^ name);
public static bool IsDBNull (this System.Data.Common.DbDataReader reader, string name);
static member IsDBNull : System.Data.Common.DbDataReader * string -> bool
<Extension()>
Public Function IsDBNull (reader As DbDataReader, name As String) As Boolean

Parameters

reader
DbDataReader

The data reader to get the column value from.

name
String

The name of the column.

Returns

true if the specified column is equivalent to DBNull; otherwise, false.

Exceptions

The name specified is not a valid column name.

Remarks

Call this method to check for null column values before calling the typed Get_*_ methods (for example, GetByte, GetChar, and so on) to avoid throwing an exception.

Applies to

See also