Skip to content

PowerShell Core - System.Data DataRow not providing the correct result. #4232

Closed

Description

I didn't pay too much attention in Beta 2 but after upgrading to Beta 3 I'm concern.

Steps to reproduce

Run Sample Code:

## - Connect and run T-SQL query
$Global:getSvr = "mtrinidadlt2,1437";
$Global:con = "server=$Global:getSvr;database=Master;Integrated Security=false;User ID=sa;" + 'Password=$Adm1n!';
$SqlQry = @'
sp_who2
'@;

$sda = New-Object System.Data.SqlClient.SqlDataAdapter ($SqlQry, $global:con)
$sdt = New-Object System.Data.DataTable
$sda.fill($sdt) | Out-Null

$sdt.rows | Select -first 5 | Format-Table

Expected behavior

DataRow data to provide proper objects results column with its data value. It works in Windows PowerShell.
(See Image)
pswindatarowok_2017-07-12_13-55-58

Actual behavior

Seems like a Python list array result: (See image)
pscoredatarowissue_2017-07-12_13-55-58

Environment data

Both OS's:
Windows 10 Build 16237
Ubuntu 16.04.02

PS C:\Program Files\PowerShell\6.0.0-beta.3> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0-beta
PSEdition                      Core
GitCommitId                    v6.0.0-beta.3
OS                             Microsoft Windows 10.0.16237
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

  1. added this to the milestone on Jul 12, 2017
  2. added
    WG-Engine
    on Jul 12, 2017
  3. daxian-dbw commented on Jul 12, 2017

    @daxian-dbw
    Member

    System.Data.DataRow and System.Data.DataRowView are back in .NET Core, but powershell hasn't enabled the corresponding object adapters.

  4. MaximoTrinidad commented on Jul 12, 2017

    @MaximoTrinidad
    Author

    At least I got a 63 line-of-code workaround to handle the issue. This way I can still demo creating a PowerShell script to query a SQL table and build the proper DataRow result to a PSObject.

    But, it would be nice to have back to one line of code.

    :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Resolution-FixedWG-Engine

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions