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 OLE DB 和 ADO 开发 » 利用 SQL Anywhere 进行 ADO 编程

 

使用 Recordset 对象

使用 SQL Anywhere 时,ADO Recordset 代表一个游标。可以通过在打开 Recordset 对象之前声明 Recordset 对象的 CursorType 属性来选择游标类型。所选游标类型控制可对 Recordset 执行的操作,并会对性能产生影响。

游标类型

ADO 有其自己对游标类型的命名约定。SQL Anywhere 支持的游标类型集在游标属性中加以说明。

下面列出可用的游标类型、相应的游标类型常量以及与它们等价的 SQL Anywhere 类型:

ADO 游标类型 ADO 常量 SQL Anywhere 类型
动态游标 adOpenDynamic 动态滚动游标
键集游标 adOpenKeyset 滚动游标
静态游标 adOpenStatic 不敏感游标
只进游标 adOpenForwardOnly 非滚动游标

有关如何选择适合应用程序的游标类型的信息,请参见选择游标类型

示例代码

下列代码集为 ADO Recordset 对象设置游标类型:

Dim myRS As New ADODB.Recordset
myRS.CursorType = ADODB.CursorTypeEnum.adOpenDynamic