ONE Active Server Pages Product Home Page Developer Site Version


ADO Recordset Object Supports Method

Determines whether a specified Recordset object supports a particular type of functionality.

Supports Method Syntax
boolean = recordset.Supports( CursorOptions )
Supports Method Parameters


A Long expression that consists of one or more of the following CursorOptionEnum values:

The AddNew method adds new records.
You can read and set the AbsolutePosition and AbsolutePage properties.
The Bookmark property accesses specific records.
The Delete method deletes records.
You can retrieve more records or change the next retrieve position without committing all pending changes.
The MoveFirst, MovePrevious, Move, and GetRows methods move the current position backward without requiring bookmarks.
The Resync method modifies existing data.
The Update method modifies existing data.
The UpdateBatch and CancelBatch methods transmit changes to the provider in groups.

Supports Method Remarks

Use the Supports method to determine what types of functionality a Recordset object supports. If the Recordset object supports the features whose corresponding constants are in CursorOptions, the Supports method returns True. Otherwise, it returns False.

Note icon Note Although the Supports method may return True for a given functionality, it does not guarantee that the provider can make the feature available under all circumstances. The Supports method simply returns whether or not the provider can support the specified functionality assuming certain conditions are met. For example, the Supports method may indicate that a Recordset object supports updates even though the cursor is based on a multi-table join, some columns of which are not updatable.
Supports Method Examples

This Visual Basic example uses the Supports method to display the options supported by a recordset opened with different cursor types. The DisplaySupport function is required for this procedure to run.

Public Sub SupportsX() 
Dim aintCursorType(4) As Integer 
Dim rstTitles As ADODB.Recordset 
Dim strCnn As String 
Dim intIndex As Integer 
` Open connections. 
strCnn = "driver={SQL Server};server=srv;" & _ 
` Fill array with CursorType constants. 
aintCursorType(0) = adOpenForwardOnly 
aintCursorType(1) = adOpenKeyset 
aintCursorType(2) = adOpenDynamic 
aintCursorType(3) = adOpenStatic 
` Open recordset using each CursorType and 
` optimitic locking. Then call the DisplaySupport 
` procedure to display the supported options. 
For intIndex = 0 To 3 
Set rstTitles = New ADODB.Recordset 
rstTitles.CursorType = aintCursorType(intIndex) 
rstTitles.LockType = adLockOptimistic 
rstTitles.Open "titles", strCnn, , , adCmdTable 
Select Case aintCursorType(intIndex) 
Case adOpenForwardOnly 
Debug.Print "ForwardOnly cursor supports:" 
Case adOpenKeyset 
Debug.Print "Keyset cursor supports:" 
Case adOpenDynamic 
Debug.Print "Dynamic cursor supports:" 
Case adOpenStatic 
Debug.Print "Static cursor supports:" 
End Select 
DisplaySupport rstTitles 
Next intIndex 
End Sub
Public Sub DisplaySupport(rstTemp As ADODB.Recordset) 
Dim alngConstants(9) As Long 
Dim booSupports As Boolean 
Dim intIndex As Integer
' Fill array with cursor option constants. 
alngConstants(0) = adAddNew 
alngConstants(1) = adApproxPosition 
alngConstants(2) = adBookmark 
alngConstants(3) = adDelete 
alngConstants(4) = adHoldRecords 
alngConstants(5) = adMovePrevious 
alngConstants(6) = adResync 
alngConstants(7) = adUpdate 
alngConstants(8) = adUpdateBatch 
For intIndex = 0 To 8 
booSupports = _ 
If booSupports Then 
Select Case alngConstants(intIndex) 
Case adAddNew 
Debug.Print " AddNew" 
Case adApproxPosition 
Debug.Print " AbsolutePosition and AbsolutePage" 
Case adBookmark 
Debug.Print " Bookmark" 
Case adDelete 
Debug.Print " Delete" 
Case adHoldRecords 
Debug.Print " holding records" 
Case adMovePrevious 
Debug.Print " MovePrevious and Move" 
Case adResync 
Debug.Print " resyncing data" 
Case adUpdate 
Debug.Print " Update" 
Case adUpdateBatch 
Debug.Print " batch updating" 
End Select 
End If 
Next intIndex 
End Sub