问题
I have a PowerShell table with 55 rows:
> $ds.tables[0].rows.count
55
When I display it in the command line, it displays fine:
> $ds.tables[0]
FIELD1 FIELD2
------ ------
r1v1 r1v2
etc etc
However, when I try pipelining it to Out-GridView (ogv), I get a blank grid, with the two field headers, but absolutley no rows!
How do I display the rows from my table in a PowerShell Out-GridView?
EDIT: As requested, here is the code:
$provider = "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"
$sql = "SELECT top 100 System.itemname, system.itemurl FROM SYSTEMINDEX WHERE contains('frog')"
$adapter = New-Object System.Data.OleDb.OleDbDataAdapter -Argument $sql, $provider
$ds = New-Object System.Data.DataSet
$adapter.fill($ds)
$ds.tables[0]
$ds.tables[0] | ogv
UPDATE: As per the comment, I checked, and the machine is running PowerShell v2.0.
来源:https://stackoverflow.com/questions/35085219/how-to-make-out-gridview-show-rows