苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

飞哥帮忙来看看 三层架构 treeview

查看数: 8287 | 评论数: 4 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2015-5-29 11:39

正文摘要:

winfrom  三层架构    treeview  怎么能?

回复

演绎· 发表于 2015-6-1 18:37:10
站长苏飞 发表于 2015-5-29 16:16
把数据生成一个Table,或者List然后再给Tree赋值应该就OK了。

http://www.sufeinet.com/thread-17-1-1.h ...

我是 新手对 数据库 和C#不是很熟悉 飞哥能 做个我看看吗
站长苏飞 发表于 2015-5-29 16:16:20
把数据生成一个Table,或者List然后再给Tree赋值应该就OK了。

http://www.sufeinet.com/thread-17-1-1.html我这里有个例子你看看
演绎· 发表于 2015-5-29 14:40:05
站长苏飞 发表于 2015-5-29 13:13
不懂你的意思,三层和treeview  有关系吗?

  private void shuaxinshu()
        {

            SqlConnection conn = new SqlConnection(conn_kai);
            conn.Open();
            string sql = string.Format("select PName from Pastern ");
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader myr = comm.ExecuteReader();
            while (myr.Read())
            {
                TreeNode tn = Pasteshudel.Nodes.Add(myr.GetString(0));
                SqlConnection conn1 = new SqlConnection(conn_kai1);
                conn1.Open();
                string sql1 = string.Format("select pid from Pastern where PName='{0}'", myr.GetString(0));
                SqlCommand comm1 = new SqlCommand(sql1, conn1);
                SqlDataReader myr1 = comm1.ExecuteReader();
                if (myr1.Read())
                {
                    pid = myr1.GetInt32(0);
                }
                myr1.Close();
                conn1.Close();

                conn1 = new SqlConnection(conn_kai1);
                conn1.Open();
                sql1 = string.Format("select SName from Specialty where pid={0}", pid);
                comm1 = new SqlCommand(sql1, conn1);
                myr1 = comm1.ExecuteReader();
                while (myr1.Read())
                {
                  TreeNode  ts=tn.Nodes.Add(myr1.GetString(0));

                    SqlConnection conn2 = new SqlConnection(conn_kai2);
                    conn2.Open();
                    string sql2 = string.Format("select sid from Specialty where SName='{0}'", myr1.GetString(0));
                    SqlCommand comm2 = new SqlCommand(sql2, conn2);
                    SqlDataReader myr2 = comm2.ExecuteReader();
                    if (myr2.Read())
                    {
                        sid= myr2.GetInt32(0);
                    }
                    myr2.Close();
                    conn2.Close();

                    conn2 = new SqlConnection(conn_kai1);
                    conn2.Open();
                    sql2 = string.Format("select CName from Class where sid={0}", sid);
                    comm2 = new SqlCommand(sql2, conn2);
                    myr2 = comm2.ExecuteReader();
                    while (myr2.Read())
                    {
                        ts.Nodes.Add(myr2.GetString(0));
                    }
                    myr2.Close();
                    conn2.Close();

                }
                myr1.Close();
                conn1.Close();
            }
            myr.Close();
            conn.Close();
        }



这个是我 平常的 treeview   我想用三层来实现    ,但是我不知道 该怎么传节点


站长苏飞 发表于 2015-5-29 13:13:38
不懂你的意思,三层和treeview  有关系吗?

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2025-2-23 11:54

© 2014-2021

快速回复 返回顶部 返回列表