Foxtable(狐表)用户栏目专家坐堂 → [求助]从数据表加载目录树,更改之后 再保存到数据表里面


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

主题:[求助]从数据表加载目录树,更改之后 再保存到数据表里面

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


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

 不要管前面的按钮,最后点保存的时候重新保存树节点。

 

 保存按钮代码

 

Dim dt As DataTable = DataTables("表B")
dt.DataRows.Clear
Dim dic As New Dictionary(of Integer, Integer)
Dim idx As Integer = 1
For Each nd As WinForm.TreeNode In tr.AllNodes
    If nd.Text <> "全部" Then
        If dic.ContainsKey(nd.Level) = False Then
            dic.Add(nd.Level, idx)
        Else
            dic(nd.Level) = idx
        End If
        Dim ndr As DataRow = dt.AddNew
        If nd.Level = 0 Then
            ndr("父键") = Nothing
        Else
            ndr("父键") = dic(nd.Level - 1)
        End If
        ndr("键") = idx
        ndr("标题") = nd.Text
        idx += 1
    End If
Next


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


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

 父键和键不影响你的使用,你引用的时候,应该是引用标题的。


 回到顶部