DataReaderExtensions.IsDBNull(DbDataReader, String) DataReaderExtensions.IsDBNull(DbDataReader, String) DataReaderExtensions.IsDBNull(DbDataReader, String) DataReaderExtensions.IsDBNull(DbDataReader, String) Method

定义

获取一个值,该值指示列中是否包含不存在或丢失的值。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

参数

reader
DbDataReader DbDataReader DbDataReader DbDataReader

要从中获取列值的数据读取器。The data reader to get the column value from.

name
String String String String

列的名称。The name of the column.

返回

如果指定的列与 DBNull 等效,则为 true;否则,为 falsetrue if the specified column is equivalent to DBNull; otherwise, false.

异常

指定的名称不是有效的列名。The name specified is not a valid column name.

注解

调用此方法可在调用类型为 Get_ * _ 方法 (例如GetByte GetChar、等) 前检查是否有空列值, 以避免引发异常。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.

适用于

另请参阅