| 发表于:2007-03-16 22:25:013楼 得分:0 |
sql语句 select inodeid, vnodename, depth, iparentid from treetable order by depth, iparentid, inodeid 查询的结果放在dt(datatable)中 inodeid编号一定要从1开始 treenodecollection [] tnc = new treenodecollection(dt.rows.count + 1); tnc[0] = treeview1.nodes; for( int i=0; i <dt.rows.count; i++) { int inodeid = convert.toint32(dt.rows[i][ "inodeid "]); int iparentid = convert.toint32(dt.rows[i][ "iparentid "]); treenode tn = new treenode(dt.rows[i][ "vnodename "].tostring(), inodeid.tostring()); tnc[inodeid] = tn.childnodes; tnc[iparentid].add(tn); } } | | |
|