档案表,DataRowAdding事件,代码
Dim drs As List(Of DataRow) = DataTables("值班表").Select("今日值班 = '值班'")
Dim lastRow As DataRow = e.DataTable.Find("", "_Identify desc")
Dim idx As Integer = 0
If lastRow IsNot Nothing Then
For i As Integer = 0 To drs.Count - 1
If drs(i)("姓名") = lastRow("姓名") Then
If i <> drs.count - 1 Then
idx = i+1
End If
End If
Next
End If
msgbox(idx)
e.DataRow("工号") = drs(idx)("工号")
e.DataRow("姓名") = drs(idx)("姓名")