views:

87

answers:

1

Hello, I have a treeList, loaded with data from SQL DB. The logigs in sql for tree is standart: ID, ParentID and other fields. Now i want to implement Copy-Paste in this tree. When I click on tree, and select "Copy" button on some node with some tree structure, i select to DataTable all information about that object and all his children, subchildren and so on. The tree can have many levels. Now i want to "paste" this selected node(with all data: childrens, subchildrens and so on) on another tree node. How i can implement that and insert into SQL all that data with relationships, like in that copied node ..? I guess here I need some recursive methods..?Maybe someione can share a little experience and examples. Thanks.

A: 

The best reference for dealing with trees in a DB is Celko's Trees and Hierarchies in SQL for Smarties.

PIck up a copy, it helped me at lot when using nested sets to store a tree hierarchy.

Tony