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 类

 

GetChars 方法

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

语法
Visual Basic

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

public override long GetChars(
   int ordinal,
   long dataIndex,
   char[] buffer,
   int bufferIndex,
   int length
);
参数
  • ordinal   从零开始的列顺序号。

  • dataIndex   行内作为读取操作起点的索引。

  • buffer   接收所复制数据的缓冲区。

  • bufferIndex   缓冲区开始执行读取操作的索引。

  • length   要读取的字符数。

返回值

实际读取的字符数。

注释

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

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

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

有关处理 BLOB 的信息,请参见处理 BLOB

另请参见