The following PowerShell code loads a SQL result into a dataset:
$sqlCommand = "SELECT A, B FROM TestTable"
$connection = New-Object System.Data.OleDb.OleDbConnection $connectionString
$command = New-Object System.Data.OleDb.OleDbCommand $sqlCommand,$connection
$connection.Open()
$adapter = New-Object System.Data.OleDb.OleDbDataAdapter $command
$dataset = New-Object System.Data.DataSet
[void] $adapter.Fill($dataSet)
I'm surprised to learn that $dataset.Tables[0].Rows[0].A works! I tried piping the row to Get-Member and indeed A and B are listed as properties of the object. Does anyone know why this is working? The DataSet was not generated from a XSD. I tried writing the same lines of code in C# and using the debugger I cannot see the properties A and B.