DataTable版 无限分类
来源:互联网 发布:度蜜月去哪个国家 知乎 编辑:程序博客网 时间:2024/04/29 11:28
private DataTable dtPowerTree = new DataTable();
const string tablename = "tree";
private void Page_Load(object sender, System.EventArgs e)
...{
FillTreeDataTable();
blTreeDataTable(0);
dtPowerTree.Clear();
// 在此处放置用户代码以初始化页面
}
private void FillTreeDataTable()
...{
string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
SqlConnection conn = new SqlConnection(ConnectionString);
SqlDataAdapter da = new SqlDataAdapter("select Id,PowerName,Layer,ParentId from " + tablename, conn);
da.Fill(dtPowerTree);
}
private void blTreeDataTable(int _ParentId)
...{
string filter = "ParentId=" + _ParentId;
string sort = "Id ASC";
DataRow[] drs = dtPowerTree.Select(filter, sort);
for(int i=0; i<drs.Length; i++)
...{
if(Convert.ToInt32(drs[i][3]) == _ParentId)
...{
int Id = Convert.ToInt32(drs[i][0]);
string PowerName = drs[i][1].ToString();
int Layer = Convert.ToInt32(drs[i][2]);
for(int space=1; space<=Layer; space++)
...{
Page.Response.Write(" ");
}
Page.Response.Write(PowerName + "<br>");
blTreeDataTable(Id);
}
}
}
const string tablename = "tree";
private void Page_Load(object sender, System.EventArgs e)
...{
FillTreeDataTable();
blTreeDataTable(0);
dtPowerTree.Clear();
// 在此处放置用户代码以初始化页面
}
private void FillTreeDataTable()
...{
string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
SqlConnection conn = new SqlConnection(ConnectionString);
SqlDataAdapter da = new SqlDataAdapter("select Id,PowerName,Layer,ParentId from " + tablename, conn);
da.Fill(dtPowerTree);
}
private void blTreeDataTable(int _ParentId)
...{
string filter = "ParentId=" + _ParentId;
string sort = "Id ASC";
DataRow[] drs = dtPowerTree.Select(filter, sort);
for(int i=0; i<drs.Length; i++)
...{
if(Convert.ToInt32(drs[i][3]) == _ParentId)
...{
int Id = Convert.ToInt32(drs[i][0]);
string PowerName = drs[i][1].ToString();
int Layer = Convert.ToInt32(drs[i][2]);
for(int space=1; space<=Layer; space++)
...{
Page.Response.Write(" ");
}
Page.Response.Write(PowerName + "<br>");
blTreeDataTable(Id);
}
}
}
- DataTable版 无限分类
- 无限分类[增强版]
- 实现无限分类(php版)
- ASP无限分类数据库版
- ASP无限分类数据库版
- 无限分类
- 无限分类
- 无限分类
- 无限分类
- 无限分类
- 无限分类
- 无限分类
- 无限分类
- 无限分类
- php 无限分类递归树形(稳定版)
- 树分类,无限极分类
- 无限分类处理类
- 实现无限分类
- 在 Ubuntu linux下安装软件
- 正则表达式(RegularExpression)
- ubuntu 显卡+桌面的安装方法
- SCADA系统简介
- win server 2003和IIS 6.0的设置
- DataTable版 无限分类
- Google翻译惹上“台独” 将台湾与中国并立
- 惠普联想炮轰Vista耗电恐怖 缩短笔记本使用时间
- Windows SDK for Vista
- session send error的解决
- JScript实现的一个String.Format方法
- XNA Kick Start (六)
- 区分JS中的undefined,null,"",0和false
- 如何禁止某个端口?