If e.NewValue IsNot Nothing Then Dim dr As DataRow Dim dr2 As DataRow dr = e.DataTable.Find("编码规则= '" & e.NewValue & "'") If dr IsNot Nothing Then MessageBox.Show("部门规则重复是否正确!","请确认") e.Cancel = True Else dr = DataTables("职员档案").Find("部门编码 = '" & e.OldValue & "'") If dr IsNot Nothing Then MessageBox.Show("已职员档案中使用,不能重命名","提示") e.Cancel = True End If End If For Each fdr As DataRow In e.DataTable.Select("编码规则 is not null") If e.NewValue.startswith(fdr("编码规则")) Then If DataTables("职员档案").find("部门编码 = '" & fdr("编码规则") & "'") IsNot Nothing Then Messagebox.Show("上级编码已使用,不能增加下级!","提示") e.Cancel=True Exit For End If End If Next End If
|