Select Case e.DataCol.name Case "仓库物料编号", "第二列" Dim dr As DataRow If e.DataCol.name = "仓库物料号" Then If e.oldvalue = Nothing Then dr = DataTables("表B").Find("仓库物料编号 = '" & e.newvalue & "' and 第二列 = '" & e.DataRow("第二列") & "'") Else dr = DataTables("表B").Find("仓库物料编号 = '" & e.oldvalue & "' and 第二列 = '" & e.DataRow("第二列") & "'") End If ElseIf e.DataCol.name = "第二列" Then If e.oldvalue = Nothing Then dr = DataTables("表B").Find("仓库物料编号 = '" & e.DataRow("仓库物料编号") & "' and 第二列 = '" & e.newvalue & "'") Else dr = DataTables("表B").Find("仓库物料编号 = '" & e.DataRow("仓库物料编号") & "' and 第二列 = '" & e.oldvalue & "'") End If End If If dr Is Nothing Then dr = DataTables("表B").AddNew() dr("仓库物料编号") = e.DataRow("仓库物料编号") dr("物料名称") = e.DataRow("物料名称") dr("规格") = e.DataRow("规格") dr("等级") = e.DataRow("等级") dr("单位") = e.DataRow("单位") Else dr("仓库物料编号") = e.DataRow("仓库物料编号") dr("第二列") = e.DataRow("第二列") End If Case "物料名称","规格","等级","单位" Dim dr As DataRow = DataTables("表B").Find("仓库物料编号 = '" & e.DataRow("仓库物料编号") & "' and 第二列 = '" & e.datarow("第二列") & "'") If dr IsNot Nothing Then dr(e.DataCol.Name) = e.DataRow(e.DataCol.Name) End If End Select
|