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 }
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);
在模仿中成长,在创新中成功