Working with the Recordset object

When working with SQL Anywhere, the ADO Recordset represents a cursor. You can choose the type of cursor by declaring a CursorType property of the Recordset object before you open the Recordset. The choice of cursor type controls the actions you can take on the Recordset and has performance implications.

Cursor types

ADO has its own naming convention for cursor types. The set of cursor types supported by SQL Anywhere is described in Cursor properties.

The available cursor types, the corresponding cursor type constants, and the SQL Anywhere types they are equivalent to, are as follows:

ADO cursor type ADO constant SQL Anywhere type
Dynamic cursor adOpenDynamic Dynamic scroll cursor
Keyset cursor adOpenKeyset Scroll cursor
Static cursor adOpenStatic Insensitive cursor
Forward only adOpenForwardOnly No-scroll cursor

For information about choosing a cursor type that is suitable for your application, see Choosing cursor types.

Sample code

The following code sets the cursor type for an ADO Recordset object:

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