1 | aa | aa | 0001 | ||
4 | aa | aa | dd | dd | 000101 |
6 | bb | bb | 0002 | ||
7 | cc | cc | 0003 | ||
8 | aa | aa | ee | ee | 000102 |
9 | aa | aa | ff | ff | 000103 |
TreeNode prevtn = new TreeNode ();
prevtn.Text="****有限公司";
this.tv_departLevel.Nodes.Clear();
this.tv_departLevel.Nodes.Add(prevtn);//增加根节点
RefreshData("00",prevtn);
private void RefreshData(string level,TreeNode parenttn)
{
System.Data.DataSet ds = _iDepartLevelMaintain.SelectDepartLevelMaintainByFilter(" and len(CurrentLevel)=" + (level.Length+2)
+" and CurrentLevel like '" +level + "%' order by CurrentLevel");
if(ds!=null)
{
if(ds.Tables!=null)
{
if(ds.Tables[0].Rows.Count>0)
{
for(int i=0;i<ds.Tables[0].Rows.Count;i++)
{
System.Data.DataRow dr = ds.Tables[0].Rows[i];
TreeNode tn = new TreeNode ();
tn.Text = dr["CurrentLevelCompName"].ToString();
parenttn.Nodes.Add(tn);
RefreshData(dr["CurrentLevel"].ToString().Trim(),tn);
}
}
}
}
}