按下列代码实现自动增加行并同步更新,请教加黑部分如何实现同步更新
Select Case e.DataCol.name
Case "编号"
If e.DataRow.IsNull("编号") = True Then
DataTables("公司不符合项管理表").DeleteFor("不符合项编号 ='" & e.DataRow("编号") & "'")
Else
Dim ndr1 As DataRow = DataTables("公司不符合项管理表").Find("不符合项编号 = '" & e.DataRow("编号") & "'")
If ndr1 Is Nothing Then
Dim ndr As Row = Tables("公司不符合项管理表").AddNew
ndr("不符合项编号") = e.DataRow("编号")
ndr("年度") = e.DataRow("年度")
ndr("产品属性") = e.DataRow("产品属性")
ndr("不符合类别") = "核电不符合项" & "" & e.DataRow("不符合项类别")
ndr("部门") = e.DataRow("部门")
ndr("开启日期") = e.DataRow("开启日期")
ndr("不符合项描述") = e.DataRow("缺陷部件_不符合项描述")
ndr("原因分析") = e.DataRow("拟定方案_原因分析_内容")
ndr("处理方案") = e.DataRow("拟定方案_纠正措施_内容")
ndr("项目或检查名称") = e.DataRow("项目名称") & "" & e.DataRow("机组号") & "" & e.DataRow("设备名称")
ndr("处理结果") = e.DataRow("关闭决定_SPEC决定")
ndr("关闭日期") = e.DataRow("关闭决定_日期")
ndr("质量损失金额") = e.DataRow("合计损失金额")
ndr("质量考核金额") = e.DataRow("质量考核金额")
ndr.Move(0)
End If
End If
End Select
If e.DataCol.Name = "年度"
Dim Filter As String = "[不符合项编号] = '" & e.DataRow("编号") & "'"
Dim drs As List(Of DataRow) = DataTables("公司不符合项管理表").Select(Filter)
For Each dr4 As DataRow In drs
dr4("年度") = e.DataRow("年度")
Next
End If
If e.DataCol.Name = "产品属性"
Dim Filter As String = "[不符合项编号] = '" & e.DataRow("编号") & "'"
Dim drs As List(Of DataRow) = DataTables("公司不符合项管理表").Select(Filter)
For Each dr4 As DataRow In drs
dr4("产品属性") = e.DataRow("产品属性")
Next
End If
If e.DataCol.Name = "开启日期"
Dim Filter As String = "[不符合项编号] = '" & e.DataRow("编号") & "'"
Dim drs As List(Of DataRow) = DataTables("公司不符合项管理表").Select(Filter)
For Each dr4 As DataRow In drs
dr4("开启日期") = e.DataRow("开启日期")
Next
End If
If e.DataCol.Name = "缺陷部件_不符合项描述"
Dim Filter As String = "[不符合项编号] = '" & e.DataRow("编号") & "'"
Dim drs As List(Of DataRow) = DataTables("公司不符合项管理表").Select(Filter)
For Each dr4 As DataRow In drs
dr4("不符合项描述") = e.DataRow("缺陷部件_不符合项描述")
Next
End If
If e.DataCol.Name = "拟定方案_原因分析_内容"
Dim Filter As String = "[不符合项编号] = '" & e.DataRow("编号") & "'"
Dim drs As List(Of DataRow) = DataTables("公司不符合项管理表").Select(Filter)
For Each dr4 As DataRow In drs
dr4("原因分析") = e.DataRow("拟定方案_原因分析_内容")
Next
End If
If e.DataCol.Name = "拟定方案_纠正措施_内容"
Dim Filter As String = "[不符合项编号] = '" & e.DataRow("编号") & "'"
Dim drs As List(Of DataRow) = DataTables("公司不符合项管理表").Select(Filter)
For Each dr4 As DataRow In drs
dr4("处理方案") = e.DataRow("拟定方案_纠正措施_内容")
Next
End If
If e.DataCol.Name = "项目名称"
Dim Filter As String = "[不符合项编号] = '" & e.DataRow("编号") & "'"
Dim drs As List(Of DataRow) = DataTables("公司不符合项管理表").Select(Filter)
For Each dr4 As DataRow In drs
dr4("项目或检查名称") = e.DataRow("项目名称") & "" & e.DataRow("机组号") & "" & e.DataRow("设备名称")
Next
End If
If e.DataCol.Name = "关闭决定_SPEC决定"
Dim Filter As String = "[不符合项编号] = '" & e.DataRow("编号") & "'"
Dim drs As List(Of DataRow) = DataTables("公司不符合项管理表").Select(Filter)
For Each dr4 As DataRow In drs
dr4("处理结果") = e.DataRow("关闭决定_SPEC决定")
Next
End If
If e.DataCol.Name = "关闭决定_日期"
Dim Filter As String = "[不符合项编号] = '" & e.DataRow("编号") & "'"
Dim drs As List(Of DataRow) = DataTables("公司不符合项管理表").Select(Filter)
For Each dr4 As DataRow In drs
dr4("关闭日期") = e.DataRow("关闭决定_日期")
Next
End If
If e.DataCol.Name = "合计损失金额"
Dim Filter As String = "[不符合项编号] = '" & e.DataRow("编号") & "'"
Dim drs As List(Of DataRow) = DataTables("公司不符合项管理表").Select(Filter)
For Each dr4 As DataRow In drs
dr4("质量损失金额") = e.DataRow("合计损失金额")
Next
End If