SqlCeDataReader.GetDecimal 方法

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

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

语法

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

returnValue = instance.GetDecimal(ordinal)
public override decimal GetDecimal(
    int ordinal
)
public:
virtual Decimal GetDecimal(
    int ordinal
) override
abstract GetDecimal : 
        ordinal:int -> decimal 
override GetDecimal : 
        ordinal:int -> decimal 
public override function GetDecimal(
    ordinal : int
) : decimal

参数

返回值

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

实现

IDataRecord.GetDecimal(Int32)

异常

异常 条件
InvalidCastException

指定的强制转换无效。

SqlNullValueException

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

InvalidOperationException

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

注释

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

SQL Server Compact 的 decimal 数据类型的最大大小大于 Decimal 的最大大小。例如,在 SqlCeDataReader 读取大于 Decimal.MaxValue 或小于 Decimal.MinValue 的值时将发生溢出。

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

请参阅

参考

SqlCeDataReader 类

System.Data.SqlServerCe 命名空间