Select Case e.DataCol.name Case "A", "B", "C" Dim dr As DataRow = e.DataRow Dim str As String = "" If e.DataCol.name = "A" Then str = e.newvalue & "|" & dr("B") & "|" & dr("C") ElseIf e.DataCol.name = "B" Then str = dr("A") & "|" & e.newvalue & "|" & dr("C") ElseIf e.DataCol.name = "C" Then str = dr("A") & "|" & dr("B") & "|" & e.newvalue End If dr = e.DataTable.Find("A + '|' + B + '|' + C = '" & str & "'") If dr IsNot Nothing Then MessageBox.Show("此已经存在!") e.Cancel = True End If end select
|