SqlCeDataReader.GetDateTime 方法

获取指定列的 DateTime 对象形式的值。

命名空间:  System.Data.SqlServerCe
程序集:  System.Data.SqlServerCe(在 System.Data.SqlServerCe.dll 中)

语法

声明
Public Overrides Function GetDateTime ( _
    ordinal As Integer _
) As DateTime
用法
Dim instance As SqlCeDataReader
Dim ordinal As Integer
Dim returnValue As DateTime

returnValue = instance.GetDateTime(ordinal)
public override DateTime GetDateTime(
    int ordinal
)
public:
virtual DateTime GetDateTime(
    int ordinal
) override
abstract GetDateTime : 
        ordinal:int -> DateTime 
override GetDateTime : 
        ordinal:int -> DateTime 
public override function GetDateTime(
    ordinal : int
) : DateTime

参数

返回值

类型:System.DateTime
指定列的值。

实现

IDataRecord.GetDateTime(Int32)

异常

异常 条件
InvalidCastException

指定的强制转换无效。

SqlNullValueException

值为 nullnull 引用(在 Visual Basic 中为 Nothing)。

InvalidOperationException

该操作无效。SqlCeDataReader 可能放置在结果集中的最后一行之后。

注释

不执行任何转换,因此所检索的数据必须已经是 DateTime 对象。

调用 IsDBNull 以便在调用此方法之前检查 null 值。

请参阅

参考

SqlCeDataReader 类

System.Data.SqlServerCe 命名空间