blackinwhite
Average Member
Turkey
657 Posts |
Posted - 02 December 2006 : 04:16:23
|
Hi all,
I have this code, populating treeview from DB. It works ok, but I can't control the urls, how can I change the URL property of a node?
Best
private void insertNodes(TreeNode n, int module_id) { SqlConnection con=new SqlConnection(@"server=SPARK\ISO;uid=sa;pwd=sa;database=ISODB"); con.Open(); SqlCommand cmd=new SqlCommand( "SELECT * FROM [module] WHERE parent_module=" + module_id,con); SqlDataReader rdr=cmd.ExecuteReader(); while(rdr.Read()) { TreeNode t=new TreeNode(rdr["module_name"].ToString(), rdr["module_id"].ToString());
insertNodes(t,Convert.ToInt16(rdr["module_id"].ToString())); if(n==null) { treeView1.Nodes.Add(t); } else n.ChildNodes.Add(t); } rdr.Close(); con.Close(); Dispose(); }
|
|