表A的DataColChanged事件
Select Case e.DataCol.Name
Case "时间"
If e.DataRow.IsNull("时间") = False Then
If WeekDay(e.DataRow("时间")) = 1
e.DataRow("星期") = "星期天"
Else
e.DataRow("星期") = WeekDayName(WeekDay(e.DataRow("时间")) - 1)
End If
Else
e.DataRow("星期") = Nothing
End If
End Select
命令窗口代码:
Dim t As Table = Tables("表A")
Dim t2 As Table = Tables("表B")
For Each r As Row In t.Rows
Select Case r("星期")
Case "星期六","星期天"
Dim vs As New List(Of String)
For Each c As Col In t.Cols
If c.Name.Contains("组") Then
For Each s As String In r(c.Name).Split(",")
vs.Add(s)
Next
End If
Next
For Each v As String In vs
Dim r2 As Row = t2.AddNew()
r2("时间") = r("时间")
r2("星期") = r("星期")
r2("姓名") = v
Next
End Select
Next
[此贴子已经被作者于2017/6/6 20:43:39编辑过]