只需要有一列ID和一列ParentID就能对应上关系了。

解决方案 »

  1.   

    A01 A01 管理部 BLB    刘总 NULL NULL
    B012 A01 财务部 CWB 刘总 NULL NULL
    B013 A01 开发部 KFB 尹总 15810283845 称重管理系统
    B014 A01 实施部 SSB 郑工 NULL NULL
    B015 A01 售后服务部 SHFWB 苗总 NULL NULL
    C01301 B013 ERP部   ERPB 小李 NULL NULL
    C01302 B013 医疗健康部 YLJKB 小刘 NULL NULL
    C01303 B013 餐饮服务部 CYFWB 小牛 NULL NULL
    C01304 B013 汽修部  QXB 小赵 NULL NULL
    C01401 B014 ERP实施部 ERPSSB 张工 NULL NULL
    C01402 B014 医疗实施部 YLSSB 贾总 NULL NULL这样建可以吗?
      

  2.   

    Index.html文件://设置为启动页面
    <html>
    <frameset cols="150,*">
        <frame name="treeview" src="Default.aspx">
        <frame name="main">
    </frameset>
    </html>//不能将frameset元素包含于body内aspx文件:
    Default.aspx:
    <body>
        <form id="form1" runat="server">
          <div>
            <asp:TreeView ID="TreeView1" runat="server" Target="main">
            </asp:TreeView>
        </div>
        </form>
    </body>Default.aspx.cs文件:
    public partial class _Default : System.Web.UI.Page 
    {
        private OleDbConnection conn;
        private OleDbDataAdapter da;
        private DataSet ds;
        private string sql;    protected void Page_Load(object sender, EventArgs e)
        {
            if ( !this.IsPostBack )
            {
                string connstr = System.Configuration.ConfigurationManager.ConnectionStrings [ "connectionString" ].ConnectionString;
                conn = new OleDbConnection ( connstr );
                sql = "SELECT * FROM [TreeViewTable]";
                da = new OleDbDataAdapter ( sql, conn );
                ds = new DataSet ();
                da.Fill ( ds, "tree" );
                InitTree ( this.TreeView1.Nodes, "000" );
            }
        }    private void InitTree ( TreeNodeCollection nodes, string parentId )
        {
            DataRow [] rows = this.ds.Tables [ "tree" ].Select ( "ParentId='" + parentId + "'" );
            foreach ( DataRow dr in rows )
            {
                TreeNode tmpNode = new TreeNode ();
                tmpNode.Text = dr [ "NodeName" ].ToString ();
                tmpNode.NavigateUrl = dr [ "Url" ].ToString ();
                nodes.Add ( tmpNode );
                string id = dr [ "NodeId" ].ToString ();
                InitTree ( tmpNode.ChildNodes, id );//递归循环添加节点
            }
        }
    }Web.config文件:
    <connectionStrings>
        <add name="connectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\data.mdb"/>//|DataDirectory|代表App_Data目录
    </connectionStrings>data.mdb记录如下:
    NodeId  ParentId
    001       000
    002       001
    003       001
    004       002
    005       002
    006       003
    007       003