DataTable.Select Method ()


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets an array of all DataRow objects.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

Public Function Select As DataRow()

Return Value

Type: System.Data.DataRow()

An array of DataRow objects.

To ensure the proper sort order, specify sort criteria with Select or Select.

The following example returns an array of DataRow objects through the Select method.

Private Sub GetRows()
    ' Get the DataTable of a DataSet.
    Dim table As DataTable = DataSet1.Tables("Suppliers")
    Dim rows() As DataRow = table.Select()

    Dim i As Integer
    ' Print the value one column of each DataRow.
    For i = 0 to rows.GetUpperBound(0)
    Next i
End Sub

.NET Framework
Available since 1.1
Return to top