Foxtable(狐表)用户栏目专家坐堂 → 目录树删除节点问题


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

主题:目录树删除节点问题

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


加好友 发短信
等级:小狐 帖子:361 积分:3436 威望:0 精华:0 注册:2012/7/24 7:15:00
目录树删除节点问题  发帖心情 Post By:2019/1/16 12:03:00 [只看该作者]

目录树由表A列1、2、3生成,列4、5、6未参与生成。
从目录树中删除节点时,弹出询问对话框,点击是,删除本节点,表A删除当前对应行,点击否,不删除节点,不删除对应行。但现在点击否时,节点未删除,但表A中对应行的列4或5的单元格内容已经被删除。这是怎么回事?
代码:
Dim tr As WinForm.TreeView = e.Form.Controls("TreeView2")
Dim nd As WinForm.TreeNode = tr.SelectedNode
If nd IsNot Nothing Then
    Dim pth() As String = nd.FullPath.Split("\")
    Select Case nd.Level
        Case 0
            DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "'")
        Case 1
            DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "'")
        Case 2
            DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "' And 岗位设置 = '" & pth(2) & "'")
        Case 3
            DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "' And 岗位设置 = '" & pth(2) & "' and 第四层机构设置 = '" & pth(3) & "'")
        Case 4
            DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "' And 岗位设置 = '" & pth(2) & "' and 第四层机构设置 = '" & pth(3) & "' and 第五层机构设置 = '" & pth(4) & "'")
        Case 5
            DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "' And 岗位设置 = '" & pth(2) & "' and 第四层机构设置 = '" & pth(3) & "' and 第五层机构设置 = '" & pth(4) & "' and 第六层机构设置 = '" & pth(5) & "'")
    End Select
    Dim Result As DialogResult
    Result = MessageBox.Show("    如果删除选定的组织机构,将导致本机构的安全职责及责任制考核标准同时被删除.  您确定要删除当前节点吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
    If Result = DialogResult.Yes Then
        nd.Delete()
    Else
    End If
End If
tr.Select()

请帮忙改一下代码。谢谢

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/1/16 12:25:00 [只看该作者]

Dim tr As WinForm.TreeView = e.Form.Controls("TreeView2")
Dim nd As WinForm.TreeNode = tr.SelectedNode
If nd IsNot Nothing Then
    Dim Result As DialogResult
    Result = MessageBox.Show("    如果删除选定的组织机构,将导致本机构的安全职责及责任制考核标准同时被删除.  您确定要删除当前节点吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
    If Result = DialogResult.Yes Then
        Dim pth() As String = nd.FullPath.Split("\")
        Select Case nd.Level
            Case 0
                DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "'")
            Case 1
                DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "'")
            Case 2
                DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "' And 岗位设置 = '" & pth(2) & "'")
            Case 3
                DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "' And 岗位设置 = '" & pth(2) & "' and 第四层机构设置 = '" & pth(3) & "'")
            Case 4
                DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "' And 岗位设置 = '" & pth(2) & "' and 第四层机构设置 = '" & pth(3) & "' and 第五层机构设置 = '" & pth(4) & "'")
            Case 5
                DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "' And 岗位设置 = '" & pth(2) & "' and 第四层机构设置 = '" & pth(3) & "' and 第五层机构设置 = '" & pth(4) & "' and 第六层机构设置 = '" & pth(5) & "'")
        End Select
        nd.Delete()
    Else
    End If
End If
tr.Select()

 回到顶部
帅哥哟,离线,有人找我吗?
deliangzhaoe
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:361 积分:3436 威望:0 精华:0 注册:2012/7/24 7:15:00
  发帖心情 Post By:2019/1/16 18:04:00 [只看该作者]

谢谢,明白了

 回到顶部