当前位置: 代码迷 >> ASP.NET >> 如何生成一个树型结构的XML文件
  详细解决方案

如何生成一个树型结构的XML文件

热度:1052   发布时间:2013-02-26 00:00:00.0
怎么生成一个树型结构的XML文件?
UserID             ChildID             ParentID
1                         1                         null
2                         2                         1
3                         3                         1
4                         4                         2
5                         5                         2


数据库的结构是这样的,我现在怎样才能写成一个树型结构的XML文件啊?

------解决方案--------------------------------------------------------
select sys_connect_by_path(parentID, '/ ') || '/ ' || childID
from userTable
start with parentID is null
connect by parentID = prior childID
------解决方案--------------------------------------------------------
then generate the xml file by the selected result
------解决方案--------------------------------------------------------
代碼范例可以參照:http://www.codeproject.com/aspnet/SquaredRomiss.asp
  相关解决方案