小编Vas*_*kin的帖子

如何在 powershell 中使用 linq explict 或在 SQL 中类似于“NOT IN”

我有一个关于在 PowerShell 中使用 Linq 的问题。我不知道如何正确使用该Except方法

示例表:

$Arr = 1..1000
$Props = ("employeeID","FindName1","FindName2")
$Table1 = New-Object System.Data.DataTable "Table1"
$Props | ForEach-Object { $Table1.Columns.Add( $_ , [String]) | Out-Null }

ForEach ($Record in $Arr ) {
    $Row = $Table1.NewRow()
    $Row.employeeID = $Record.ToString("00000")
    $Row.FindName1 = "UserName_" + $Record.ToString()
    $Row.FindName2 = "String_" + $Record.ToString("00000000")
    $Table1.Rows.Add($Row)
}

$Arr2 = 980..1111
$Props = ("employeeID","FindName1")
$Table2 = New-Object System.Data.DataTable "Table2"
$Props | ForEach-Object { $Table2.Columns.Add( $_ , [String]) | Out-Null }

ForEach ($Record in $Arr2 …
Run Code Online (Sandbox Code Playgroud)

linq datatable powershell

3
推荐指数
1
解决办法
718
查看次数

标签 统计

datatable ×1

linq ×1

powershell ×1