private void Page_Load(object sender, System.EventArgs e)
{  
// 在此处放置用户代码以初始化页面 // 创建第一个 TreeNote
TreeNode tvFirst = new TreeNode();
// 创建第二个 TreeNote
TreeNode tvSecond = new TreeNode();
string sql="select distinct ygbh,shjygbh from  bgjgl where shjygbh='020400345'";
System.Data.SqlClient.SqlConnection sqlConn=new System.Data.SqlClient.SqlConnection("Data Source=(local);Integrated Security=SSPI;Initial Catalog=LaborLog;");
sqlConn.Open();
System.Data.SqlClient.SqlDataAdapter tAdapter;
tDataSet = new DataSet();
tAdapter = new System.Data.SqlClient.SqlDataAdapter(sql,sqlConn);
tAdapter.Fill(tDataSet,"temp");

                                                      int count = tDataSet.Tables["temp"].Rows.Count;

tvFirst.Text = tDataSet.Tables["temp"].Rows[0]["shjygbh"].ToString () ;
for(int i=0;i<count;i++)
{
 tvSecond.Text = tDataSet.Tables["temp"].Rows[i]["ygbh"].ToString ()  ;


// 将第二个 TreeNote 添加为第一个 TreeNote 的子节点
tvFirst.Nodes.Add(tvSecond); // 将第一个 TreeNote 添加到 TreeView 的根节点中。
this.TreeView1.Nodes.Add(tvFirst);
  

}
这是把包括上级领导和其所有直接下属显示到treeview中。
可是for循环中出错。请指教!
错误信息:
Attempted to add a TreeNode to a second TreeNodeCollection. A TreeNode can belong to only one TreeNodeCollection. Remove the TreeNode from its old collection before adding it to a new one.