表B,datacolchanged事件
Select Case e.DataCol.name
Case "生产批车次号"
If e.DataRow.IsNull("卷号") = False Then
Dim dr As DataRow
If e.OldValue = Nothing Then
dr = DataTables("c表").Find("生产批号 = '" & e.NewValue & e.DataRow("卷号") & "'")
Else
dr = DataTables("c表").Find("生产批号 = '" & e.oldvalue & e.DataRow("卷号") & "'")
End If
If dr Is Nothing Then
dr = DataTables("c表").AddNew()
End If
dr("生产批号") = e.NewValue & e.DataRow("卷号")
dr("母卷号") = e.DataRow("母卷号")
End If
Case "卷号"
If e.DataRow.IsNull("生产批车次号") = False Then
Dim dr As DataRow
If e.OldValue = Nothing Then
dr = DataTables("c表").Find("生产批号 = '" & e.DataRow("生产批车次号") & e.DataRow("卷号") & "'")
Else
dr = DataTables("c表").Find("生产批号 = '" & e.DataRow("生产批车次号") & e.OldValue & "'")
End If
If dr Is Nothing Then
dr = DataTables("c表").AddNew()
End If
dr("生产批号") = e.DataRow("生产批车次号") & e.DataRow("卷号")
dr("母卷号") = e.DataRow("母卷号")
End If
End Select