惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Blog — PlanetScale
Blog — PlanetScale
腾讯CDC
aimingoo的专栏
aimingoo的专栏
Microsoft Azure Blog
Microsoft Azure Blog
A
About on SuperTechFans
J
Java Code Geeks
G
Google Developers Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
罗磊的独立博客
GbyAI
GbyAI
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - huadust

msdn 网络编程 委托用法 注册表操作 DateTime各种用法 [转]将dll汇入exe Lock Review String Review Class Review DataTable opertion Drag DataGridView Data To TreeView 2009_01_15_星期三 2009_01_02_星期五 2008_12_31_星期三 2008_12_24_星期三 2008_12_20_星期六 2008_12_17_星期三 2008_12_06_星期六 2008_12_04_星期四
用DataTable构建树
huadust · 2011-04-05 · via 博客园 - huadust

 3 public void AddTree(int ParentID,TreeNode pNode) 
 4 {
 5     DataView dvTree = new DataView(ds.Tables[0]);
 6     dvTree.RowFilter =  "[PARENTID] = " + ParentID;
 7     foreach(DataRowView Row in dvTree) 
 8     {
 9         if(pNode == null
10         {
11             TreeNode Node = treeView1.Nodes.Add(Row["ConText"].ToString());
12             AddTree(Int32.Parse(Row["ID"].ToString()),Node);
13         } 
14         else 
15         {
16             TreeNode Node =  pNode.Nodes.Add(Row["ConText"].ToString());
17             AddTree(Int32.Parse(Row["ID"].ToString()),Node);
18         }
19     }            
20 }

AddTree(0, (TreeNode)null);