Code works fine until I try to add a custom column using:
$datatable.Columns.Add("AD_description1", "String")
If I comment the string I can perfectly see results in GridView. But once the string uncommented the gridview displays:
How do I add a custom field properly?
$adapter = New-Object System.Data.OleDb.OleDbDataAdapter($QueryString, $ConnectionString)
#Load the DataTable
$datatable = New-Object System.Data.DataTable
[void]$adapter.Fill($datatable)
$datatable.Columns.Add("AD_description1", "String")
$datatable | out-gridview
See these results:
References: