如何对树子进行排序 [英] how do sort the tree child

查看:116
本文介绍了如何对树子进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

List<string> retList = new List<string>();
            FilterName.Clear();
            string connectionString = "Provider=Microsoft.JET.OLEDB.4.0;data source=" + strPath;
            OleDbConnection conn = new OleDbConnection(connectionString);
            string sql = "SELECT DISTINCT "+stringColName+" From " + strTable;
            OleDbCommand cmd = new OleDbCommand(sql, conn);
            conn.Open();
            OleDbDataReader reader;
            reader = cmd.ExecuteReader();
            TreeNode tn = null;


朋友你好.
我们使用数据库.即Provider = Microsoft.JET.OLEDB.4.0;
我的应用程序还从数据库甚至树节点中获取了整个数据..
我想知道如何对树状子进行排序...

代码是:


hello friends.
we use a database.i.e Provider=Microsoft.JET.OLEDB.4.0;
my application fetch the whole data from the database even tree node also..
i want to know how to do the sorting of tree child...

code is :

List<string> reeList = new List<string>();
            FilterName.Clear();
            string connectionString = "Provider=Microsoft.JET.OLEDB.4.0;data source=" + strPath;
            OleDbConnection conn = new OleDbConnection(connectionString);
            string sql = "SELECT DISTINCT "+stringColName+" From " + strTable;
            OleDbCommand cmd = new OleDbCommand(sql, conn);
            conn.Open();
            OleDbDataReader reader;
            reader = cmd.ExecuteReader();
            TreeNode tn = null; 
tn=new TreeNode(ParentNode);
while(reader.Read())
{
tn.Nodes>Add(reader.GetString(0),reader.GetString(0))
FilterName.Add(reader.GetString(0));
}</string></string>


请告诉我这段代码是如何完成树孩子的工作的.


please tell me how this code do the sort of tree child.

推荐答案

开始
Start here[^]: you should be able to adapt the code to your needs.


这篇关于如何对树子进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆