SqlDataReader.GetTimeSpan(Int32) 方法

定义

检索指定列的 TimeSpan 对象形式的值。Retrieves the value of the specified column as a TimeSpan object.

public:
 virtual TimeSpan GetTimeSpan(int i);
public virtual TimeSpan GetTimeSpan (int i);
abstract member GetTimeSpan : int -> TimeSpan
override this.GetTimeSpan : int -> TimeSpan
Public Overridable Function GetTimeSpan (i As Integer) As TimeSpan

参数

i
Int32

从零开始的列序号。The zero-based column ordinal.

返回

TimeSpan

指定列的值。The value of the specified column.

例外

指定的强制转换无效。The specified cast is not valid.

注解

不执行任何转换;因此,检索的数据必须已经是 TimeSpan 对象。No conversions are performed; therefore, the data retrieved must already be a TimeSpan object.

调用 IsDBNull 以在调用此方法前检查是否有 null 值。Call IsDBNull to check for null values before calling this method.

适用于