SqlDataRecord.GetBytes(Int32, Int64, Byte[], Int32, Int32) 方法

定义

获取序号指定的列的值,其形式为 Byte 对象数组。

public:
 virtual long GetBytes(int ordinal, long fieldOffset, cli::array <System::Byte> ^ buffer, int bufferOffset, int length);
public virtual long GetBytes (int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length);
abstract member GetBytes : int * int64 * byte[] * int * int -> int64
override this.GetBytes : int * int64 * byte[] * int * int -> int64
Public Overridable Function GetBytes (ordinal As Integer, fieldOffset As Long, buffer As Byte(), bufferOffset As Integer, length As Integer) As Long

参数

ordinal
Int32

从零开始的列序号。

fieldOffset
Int64

开始检索字节的字段值内的偏移量。

buffer
Byte[]

要将字节复制到的目标缓冲区。

bufferOffset
Int32

要将字节开始复制到的缓冲区内的偏移量。

length
Int32

要复制到缓冲区的字节数。

返回

已复制的字节数。

实现

例外

ordinal 小于 0 或大于列数(即 FieldCount)。

ordinal 指定的列为 null。

类型不匹配。

注解

使用此方法,可以在单个调用或区块中获取二进制值。 对于较大的值或未知大小的值,获取区块中的值很有用。

若要获取多个区块中的值,请分配区块大小的字节数组并重复调用 GetBytes ,在每个调用中相应地调整 fieldOffset 参数。

适用于