急啊!help me !怎么让treeview在页面上显示(treeview + oracle)
这是我的。CS代码:
protected void Page_Load(object sender, EventArgs e)
{
TreeView TreeView1 = new TreeView();
TreeView1.Nodes.Clear();
OracleConnection myConnection = new OracleConnection(Page_SQL_CONN_Entity);
myConnection.Open();
OracleCommand MySelectOrc = new OracleCommand("select action_column_id,action_column_name from sys_action_column order by action_column_id",myConnection);
OracleDataReader oda = MySelectOrc.ExecuteReader();
while (oda.Read())
{
TreeNode tn1 = new TreeNode();
tn1.Text = oda[0].ToString();
//tn1.Target = "NodeEdit";//链接目标
//tn1.NavigateUrl = "MODULEEdit.asp?MODULEID=" + oda[0].ToString();//链接地址
OracleCommand MySelectOrc1 = new OracleCommand("select action_column_id,action_column_name from sys_action_column where action_column_name='" + oda[0].ToString() + "' order by action_column_id", myConnection);
OracleDataReader oda1 = MySelectOrc1.ExecuteReader();
while(oda1.Read())
{
TreeNode tn2=new TreeNode();
tn2.Text=oda1[1].ToString();
//tn2.Target = "NodeEdit";
//tn2.NavigateUrl = "TASKTYPEEdit.asp?TASKTYPEID=" + oda1[0].ToString();
OracleCommand MySelectOrc2 = new OracleCommand("select id,action_name from action_column_id where action_name='" + oda1[0].ToString() + "' order by action_column_id", myConnection);
OracleDataReader oda2 = MySelectOrc2.ExecuteReader();
oda2.Close();
tn1.ChildNodes.Add(tn2);
}
oda1.Close();
TreeView1.Nodes.Add(tn1);
}
oda.Close();
myConnection.Close();
}
请各位大虾多多帮忙
------解决方案--------------------
没说清楚
不明白楼主想要解决什么?
------解决方案--------------------tn1.Text = oda[0].ToString();
tn2.Text=oda1[1].ToString();
都有值吗?
------解决方案--------------------另外 tn1.ChildNodes.Add(tn2);
改成: tn1.Nodes.Add(tn2)试试.
------解决方案--------------------http://www.lokcore.com/avrilxu/article.asp?id=3
有两篇,看看吧
------解决方案--------------------顶住啊,路过而已