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

定义

从按指定的列偏移量将字节流作为数组从给定的缓冲区偏移量开始读入缓冲区。

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

参数

ordinal
Int32

从零开始的列序号。

dataIndex
Int64

字段中作为读取操作起始位置的索引。

buffer
Byte[]

要读入字节流的缓冲区。

bufferIndex
Int32

buffer 中写入操作开始位置的索引。

length
Int32

复制到缓冲区中的最大长度。

返回

读取的实际字节数。

实现

注解

GetBytes 返回 字段中的可用字节数。 大多数情况下,这是字段的确切长度。 但是,如果 GetBytes 已用于从字段中获取字节,则返回的数字可能小于字段的真实长度。 例如,当 将大型数据结构读取到缓冲区中时 OleDbDataReader ,可能会发生这种情况。 有关详细信息, SequentialAccess 请参阅 的设置 CommandBehavior

如果传递的缓冲区为 nullGetBytes 则返回字段的长度(以字节为单位)。

不执行任何转换;因此,检索到的数据必须已是字节数组。

适用于

另请参阅