Select Case e.DataCol.name
Case "日期","姓名"
Dim dr As DataRow = e.DataRow
If dr.IsNull("日期") = False AndAlso dr.IsNull("姓名") = False Then
Dim d As Date = dr("日期").Date
If e.DataTable.Compute("Count([_Identify])","日期 >= '" & d & "' and 日期 < '" & d.AddDays(1) & "' And 姓名 = '" & dr("姓名") & "'") > 1 Then
MessageBox.Show("已经存在相同日期和姓名的行!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.DataRow(e.DataCol.Name) = e.OldValue '取消输入
End If
End If
End Select