For Each sj As DataRow In DataTables("工资表").DataRows If sj.IsNull("姓名")=False sj("工资月份") = nian.Value & "年" & yue.Value & "月" End If Next Dim dr As DataRow dr = DataTables("工资总表").find(" [工资月份] = " & sj("工资月份")) If dr IsNot Nothing MessageBox.Show("此月工资已经存在!") End If