我希望实现:如果“机房板件端口表”中新增加未保存的行与“板件端口列表”中存在‘设备名称’ ‘设备型号’ ‘板件型号’相同的行;就将”板件端口列表“中符号条件的行复制到”机房板件端口表“中去;但是下面的命令却是把所有的数据都复制了一遍;把原来”机房板件端口表“中存在的数据全部覆盖掉了;我这个命令该怎么修改?
DataTables("机房板件端口表").DataRows.Clear
For Each dr As DataRow In DataTables("机房设备板件表").Select("机房名称 is not null")
Dim drs As List(Of DataRow) = DataTables("板件端口列表").Select("设备名称 = '" & dr("设备名称") & "' and 设备型号 = '" & dr("设备型号") & "' and 板件型号 = '" & dr("板件型号") & "'")
For Each r As DataRow In drs
Dim ndr As DataRow = DataTables("机房板件端口表").AddNew
ndr("机房名称") = dr("机房名称")
ndr("设备名称") = r("设备名称")
ndr("设备型号") = r("设备型号")
ndr("设备编号") = dr("设备编号")
ndr("端口类型") = r("端口类型")
ndr("端口编号") = r("端口编号")
ndr("板件名称") = r("板件名称")
ndr("板件型号") = r("板件型号")
ndr("板件槽位") = dr("板件槽位")
ndr("板件型号") = r("板件型号")
Next
Next