IDataRecord.IsDBNull(Int32) 方法

定义

返回指定字段是否设置为 null。Return whether the specified field is set to null.

public:
 bool IsDBNull(int i);
public bool IsDBNull (int i);
abstract member IsDBNull : int -> bool
Public Function IsDBNull (i As Integer) As Boolean

参数

i
Int32

要查找的字段的索引。The index of the field to find.

返回

Boolean

如果指定的字段设置为 null,则为 true;否则为 falsetrue if the specified field is set to null; otherwise, false.

例外

传递的索引位于 0 至 FieldCount 的范围之外。The index passed was outside the range of 0 through FieldCount.

注解

调用此方法以查看在调用类型化 get 方法之前是否存在 null 列值 (例如,、 GetByte GetChar 等) 避免引发错误。Call this method to see if there are null column values before calling the typed get methods (for example, GetByte, GetChar, and so on) to avoid raising an error.

适用于