ADO and SQL Server

Using Cursors with ADO

ADO uses both client and server cursors to implement the cursor functionality required by an application. An ADO application controls the cursor behavior by using the CursorType, CursorLocation, LockType, and CacheSize properties of the Recordset object.

When these properties are set to their default values at the time an SQL statement is executed, the Microsoft OLE DB Provider for SQL Server (SQLOLEDB) does not use a server cursor to implement the result set; instead, it uses a default result set. If any of the values of these properties are changed from their default values at the time an SQL statement is executed, SQLOLEDB attempts to use a server cursor to implement the result set.

Cursor Options with SQL Server

Because ADO allows the setting of cursor properties,  the following options exist for using cursors with ADO and Microsoft® SQL Server™ 2000:

ADO Cursor Settings

An ADO application can control the cursor functionality using these Recordset properties.

Property Description
CursorType Default: adOpenForwardOnly
Indicates the type of cursor used:
Forward-only/read-only (adOpenForwardOnly)
Static (adOpenStatic)
Keyset (adOpenKeyset)
Dynamic (adOpenDynamic)
CursorLocation Default: adUseServer
Sets or returns the location of the cursor engine. If you set this property to adUseClient, you can open only a static cursor.
LockType Default: adLockReadOnly
Indicates the type of locks placed on rows during editing.
CacheSize Default: 1
Controls how many rows the provider keeps in its buffer and how many rows to retrieve at one time into local memory.

See Also

Cursors