Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » SQL Anywhere 服务器 - 编程 » SQL Anywhere 数据访问 API » SQL Anywhere .NET 2.0 API 参考 » iAnywhere.Data.SQLAnywhere 命名空间 (.NET 2.0) » SADataReader 类

 

GetBytes 方法

以给定缓冲区偏移为起点,将字节流作为数组从指定的列偏移读入到缓冲区中。

语法
Visual Basic

Public Overrides Function GetBytes( _
   ByVal ordinal As Integer, _
   ByVal dataIndex As Long, _
   ByVal buffer As Byte(), _
   ByVal bufferIndex As Integer, _
   ByVal length As Integer _
) As Long
C#

public override long GetBytes(
   int ordinal,
   long dataIndex,
   byte[] buffer,
   int bufferIndex,
   int length
);
参数
  • ordinal   表示获取值的来源列的顺序号。编号从零开始。

  • dataIndex   从中读取字节的列值内的索引。

  • buffer   存储数据的数组。

  • bufferIndex   数组中作为数据复制起点的索引。

  • length   要复制到指定缓冲区中的最大长度。

返回值

读取的字节数。

注释

GetBytes 返回字段中的可用字节数。在大多数情况下,这是字段的实际长度。然而,如果 GetBytes 已经用于从字段中获取字节,则返回的数字可能比字段的实际长度小。例如,当 SADataReader 将一个较大的数据结构读入缓冲区时,就可能出现这种情况。

如果传递的缓冲区是空值引用(在 Visual Basic 中是 Nothing),GetBytes 会以字节为单位返回该字段的长度。

不会进行任何转换,因此检索的数据必须已经是字节数组。

另请参见