Search notes:

System.Data.DataTable (class)

A System.Data.DataTable object represents one in-memory table of data. It is the central object in the ADO.NET environment.
A parent-child relationship between two DataTable's can be established with a System.Data.DataRelation.
System.Data.DataTableReader obtains the contents of one or more DataTable objects in the form of one or more read-only, forward-only result sets and thus allows to iterate over the rows in a DataTable.

Powershell/Oracle example: Load() to fill a DataTable

A DataTable can be filled by calling Load() and providing an System.Data.IDataReader.
Such an interface is returned by the method ExecuteReader() of the class System.Data.Common.DbCommand].
#
#  Script must possibly be run in a 32-bit environment.
#

$oraUser       = '‥'
$oraPw         = '‥'
$dataSource    = '‥'

$assembly = [System.Reflection.Assembly]::LoadWithPartialName('System.Data.OracleClient')

if (! $assembly) {
   write-host 'System.Data.OracleClient could not be loaded!'
   return
}

$connStr = "User Id=$oraUser;Password=$oraPw;Data Source=$dataSource"

$conn = new-object System.Data.OracleClient.OracleConnection($connStr)
$conn.Open()

if ($conn.state -ne 'Open') {
   write-host 'could not open connection'
   return
}

$cmd = new-object System.Data.OracleClient.OracleCommand
$cmd.Connection = $conn
$cmd.CommandText = "select * from user_objects where object_type in ('TABLE', 'VIEW') order by object_name"

$tab = new-object System.Data.DataTable
$tab.Load($cmd.ExecuteReader())

write-host "Selected $($tab.Rows.Count) rows"
$tab | select-object object_name, object_type > result.txt

$tab | foreach-object {
    write-host $_.created
}

$conn.Close()

See also

Rows of a DataTable are represented by instances of System.Data.DataRow, columns by instances of System.Data.DataColumn.
Compare with System.Data.DataSet

Index