how do i iterate through a resultset obtained from using the SQLPSX get-sqldata? I want to output the resultset to an excel file. i'm ok with creating the excel file.
thanks
SQLPSX get-sqldata returns an ADO.Net DataTable. One way to iterate we be to use a ForEach like this:
$tbl = get-sqldata ...
foreach ($row in $tbl) {
$($row.Field)
...
}
Enclosing the field in a $( ) ensures you get the underlying data primitive.
That's what I wanted to hear! thanks so much. I've spent hours and hours messing round with different ways. just couldn't work out why $row.Field by itself didn't work. Didn't know about this $(....) thing.
thanks a lot
Steve