DataReaderExtensions.GetBytes(DbDataReader, String, Int64, Byte[], Int32, Int32) 方法
定义
从指定列中指定索引处开始读取指定字节数,并将其写入缓冲区中从指定位置开始的缓冲区。Reads a specified number of bytes from the specified column starting at a specified index and writes them to a buffer starting at a specified position in the buffer.
public:
[System::Runtime::CompilerServices::Extension]
static long GetBytes(System::Data::Common::DbDataReader ^ reader, System::String ^ name, long dataOffset, cli::array <System::Byte> ^ buffer, int bufferOffset, int length);
public static long GetBytes (this System.Data.Common.DbDataReader reader, string name, long dataOffset, byte[] buffer, int bufferOffset, int length);
static member GetBytes : System.Data.Common.DbDataReader * string * int64 * byte[] * int * int -> int64
<Extension()>
Public Function GetBytes (reader As DbDataReader, name As String, dataOffset As Long, buffer As Byte(), bufferOffset As Integer, length As Integer) As Long
参数
- reader
- DbDataReader
要从中获取列值的数据读取器。The data reader to get the column value from.
- name
- String
列的名称。The name of the column.
- dataOffset
- Int64
行中作为读取操作起始位置的索引。The index within the row from which to begin the read operation.
- buffer
- Byte[]
要将数据复制到的缓冲区。The buffer into which to copy the data.
- bufferOffset
- Int32
要将数据复制到的位置的缓冲区索引。The index with the buffer to which the data will be copied.
- length
- Int32
最多读取的字符数。The maximum number of characters to read.
返回
读取的实际字节数。The actual number of bytes read.
例外
指定的名称不是有效的列名。The name specified is not a valid column name.
指定的强制转换无效。The specified cast is not valid.