我正在寻找总结“状态”字段。
Dim _detailRecords As New DataTable
_detailRecords.Columns.Add("y")
_detailRecords.Columns.Add("z")
_detailRecords.Columns.Add("A", GetType(Int32))
Dim workRow As DataRow
Dim i As Integer
For i = 1 To 3
workRow = _detailRecords.NewRow()
workRow(0) = i.ToString()
workRow(1) = "CustName" & i.ToString()
workRow(2) = i + 1
_detailRecords.Rows.Add(workRow)
Next
For i = 1 To 3
workRow = _detailRecords.NewRow()
workRow(0) = i.ToString()
workRow(1) = "CustName" & i.ToString()
workRow(2) = i + 1
_detailRecords.Rows.Add(workRow)
Next
Dim query8 As IEnumerable(Of DataRow) = (From record As DataRow In _detailRecords _
Group record By y = record.Field(Of String)("y"), _
z = record.Field(Of String)("z"), _
Status = record.Field(Of Int32)("Status") Into groupedRecords = Group _
Select groupedRecords.FirstOrDefault())
我还想将其保留为 DataRow 的 IEnumerable,因为我将使用它创建一个数据表
Dim yyyyy As DataTable = query8.CopyToDataTable