Foxtable(狐表)用户栏目专家坐堂 → [求助]已使用的一级不允许增加下级


  共有3205人关注过本帖树形打印复制链接

主题:[求助]已使用的一级不允许增加下级

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/2/4 16:25:00 [显示全部帖子]

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

 回到顶部