ADO » Recordset » CursorType

Syntax:
CursorTypeEnum = recordsetobject.CursorType
recordsetobject.CursorType = CursorTypeEnum

Sets or returns a CursorTypeEnum value that defines the type of cursor being used.

The CursorType property sets or returns a CursorTypeEnum constant that specifies the type of cursor to use when you open a Recordset object. Unfortunately, not all types of cursors are recognized by all providers. If you request a cursor type that is not supported, the provider will probably change the type. The value of the CursorType property will be changed accordingly.

After the Recordset is open, you cannot set the CursorType property. However, you can return the property to see which cursor is actually being used.

CursorTypeEnum Constants
 

Constant Value Description
adOpenDynamic 2 A dynamic cursor with both forward and backward scrolling where additions, deletions, insertions, and updates made by other users are visible
adOpenForwardOnly 0 Default, a forward scrolling only, static cursor where changes made by other users are not visible
adOpenKeyset 1 A keyset cursor allows you to see dynamic changes to a specific group of records but you cannot see new records added by other users
adOpenStatic 3 A static cursor allowing forward and backward scrolling of a fixed, unchangeable set of records
adOpenUnspecified -1 Cursor type not specified

Examples

Code:
Set objRecordset = Server.CreateObject("ADODB.Recordset")
Set objRecordset.ActiveConnection = strConnection
objRecordset.CursorLocation = adUseClient
objRecordset.CursorType = adOpenDynamic
...
objRecordset.Open "ChantList", , , , adCmdTable

See Also: