Dim dt As DataTable = DataTables("人员任务统计")
dt.DataRows.Clear
Dim cs() As String = {"左座", "右座", "操纵者", "观察员1"}
For Each dr As DataRow In DataTables("任务书").Select("", "飞行日期")
Dim ndr As DataRow
For Each c As String In cs
If dr.IsNull(c) = False Then
If c = "操纵者" Then
ndr = dt.Find("姓名 = '" & dr(c) & "'", "_Identify desc")
Else
ndr = dt.AddNew
End If
ndr("日期") = dr("飞行日期")
ndr("机型") = dr("机型")
ndr("姓名") = dr(c)
ndr(c) = True
ndr("总时间") = dr("总时间")
If c = "操纵者" Then
ndr("起落架次") = dt.Compute("sum(起落架次)", "姓名 = '" & dr(c) & "'") + dr("起落架次")
Else If c = "观察员1" Then
Else
ndr("经历时间") = dt.Compute("sum(经历时间)", "姓名 = '" & dr(c) & "'") + dr("经历时间")
End If
End If
Next
Next