新增行的时候加判断
For Each key As String In dic.keys if datatables("零件需求").find("零件= '" & key & "'") is nothing then Dim dr As DataRow = DataTables("零件需求").AddNew() dr("零件") = key dr("需求数量") = dic(key) end ifNext