SqlCeDataReader.GetBytes 方法
从按指定的列偏移量将字节流作为数组从给定的缓冲区偏移量开始读入缓冲区。
命名空间: System.Data.SqlServerCe
程序集: System.Data.SqlServerCe(在 system.data.sqlserverce.dll 中)
语法
声明
Public Overrides Function GetBytes ( _
ordinal As Integer, _
dataIndex As Long, _
buffer As Byte(), _
bufferIndex As Integer, _
length As Integer _
) As Long
用法
Dim instance As SqlCeDataReader
Dim ordinal As Integer
Dim dataIndex As Long
Dim buffer As Byte()
Dim bufferIndex As Integer
Dim length As Integer
Dim returnValue As Long
returnValue = instance.GetBytes(ordinal, dataIndex, buffer, bufferIndex, length)
public override long GetBytes (
int ordinal,
long dataIndex,
byte[] buffer,
int bufferIndex,
int length
)
public:
virtual long long GetBytes (
int ordinal,
long long dataIndex,
array<unsigned char>^ buffer,
int bufferIndex,
int length
) override
public long GetBytes (
int ordinal,
long dataIndex,
byte[] buffer,
int bufferIndex,
int length
)
public override function GetBytes (
ordinal : int,
dataIndex : long,
buffer : byte[],
bufferIndex : int,
length : int
) : long
不适用。
参数
- ordinal
从零开始的列序号。
- dataIndex
字段中的索引,从其开始读取操作。
- buffer
要将字节流读入的缓冲区。
- bufferIndex
开始读取操作的 buffer 的索引。
- length
要复制到缓冲区中的最大长度。
返回值
读取的实际字节数。
异常
异常类型 | 条件 |
---|---|
该操作无效。SqlCeDataReader 可以被放置于结果集的最后一行。 |
备注
GetBytes 返回字段中的可用字节数。大多数情况下,它是字段的确切长度。但是,如果 GetBytes 已用于从字段中获取字节,则所返回的数字可能会小于该字段的真实长度。例如,如果 SqlCeDataReader 将一个大型数据结构读入缓冲区,则可能出现这种情况。有关更多信息,请参见 CommandBehavior 的 SequentialAccess 设置。
如果传递为 空引用(在 Visual Basic 中为 Nothing) 的缓冲区,则 GetBytes 以字节为单位返回字段的长度。
不执行任何转换,因此所检索的数据必须已经是字节数组。
平台
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
Windows Vista、Microsoft Windows XP SP2 和 Windows Server 2003 SP1 支持 Microsoft .NET Framework 3.0。
版本信息
.NET Framework
受以下版本支持:3.0
.NET Compact Framework
受以下版本支持:2.0、1.0
请参见
参考
SqlCeDataReader 类
SqlCeDataReader 成员
System.Data.SqlServerCe 命名空间