OrdinalPosition Property Example

This example illustrates how columns are numbered with the OrdinalPosition property.

Private Sub ShowOrdinals()
Dim rs As rdoResultset
Dim cn As New rdoConnection
Dim cl As rdoColumn
Dim er As rdoError

On Error GoTo EH
With cn
    .Connect = "uid=;pwd=;server=SEQUEL;" _
    & "driver={SQL Server};database=pubs;" _
    & "DSN='';"
    .CursorDriver = rdUseNone
    .EstablishConnection rdDriverNoPrompt
    Set rs = cn.OpenResultset( _
      "select * from titles where Price < 50")
    For Each cl In rs.rdoColumns
        Debug.Print cl.OrdinalPosition,  _
         cl.Name, cl.Value
    Next
End With
Exit Sub
EH:
    For Each er In rdoErrors
        Debug.Print er.Description
    Next er
    Resume Next
End Sub