MyTreeNode Node; //-----SYSTEM----- //Gets the SYSTEMS into the variable currentSystems var currentSystems = DAObject.fetch("SELECT * FROM TSystem").AsEnumerable(); if (currentSystems.Count() > 0) foreach (DataRow systemRow in currentSystems) { Node = new MyTreeNode( systemRow["strSystemName"].ToString(), DAObject.GetLinage(systemRow["strFormIdName"].ToString()).ToString(), systemRow["strFormIdName"].ToString() ); Node.ForeColor = Color.Green; treeView1.Nodes.Add(Node); //-----SUBSYSTEMS----- //Gets the system SUBSYSTEMS into the variable currentSystemSubSystems var currentSystemSubSystems = from subSystem in (DAObject.fetch("SELECT * FROM TSubSystem").AsEnumerable()) where subSystem["nSystemId"] == systemRow["nSystemId"] select subSystem; if (currentSystemSubSystems.Count() > 0) foreach (DataRow subSystemRow in currentSystemSubSystems) { Node = new MyTreeNode( subSystemRow["strSubsystemName"].ToString(), DAObject.GetLinage(subSystemRow["strSubFormID"].ToString()).ToString(), subSystemRow["strSubFormID"].ToString() ); Node.ForeColor = Color.Green; treeView1.Nodes.Add(Node); //-----MENUS----- //Gets the Subsystem MENUS into the variable currentSubSystemMenus var currentSubSystemMenus = from Menu in (DAObject.fetch("SELECT * FROM TMenu").AsEnumerable()) where Menu["nSubsytemId"] == subSystemRow["nSubsytemId"] select Menu; if (currentSubSystemMenus.Count() > 0) foreach (DataRow menuRow in currentSubSystemMenus) //First time error comes up at this line, when I continue it occurs on other loops { Node = new MyTreeNode( subSystemRow["strMenuname"].ToString(), DAObject.GetLinage(subSystemRow["strMenuFormID"].ToString()).ToString(), subSystemRow["strMenuFormID"].ToString() ); Node.ForeColor = Color.Green; treeView1.Nodes.Add(Node); //-----SUBMENUS----- //Gets the Menu SUBMENUS into the variable currentMenuSubMenus var currentMenuSubMenus = from subMenu in (DAObject.fetch("SELECT * FROM TSubMenu").AsEnumerable()) where subMenu["nMenuID"] == menuRow["nMenuID"] select subMenu; if (currentMenuSubMenus.Count() > 0) foreach (DataRow subMenuRow in currentMenuSubMenus) { Node = new MyTreeNode( subSystemRow["strSubMenuName"].ToString(), DAObject.GetLinage(subSystemRow["strSubMenuFormID"].ToString()).ToString(), subSystemRow["strSubMenuFormID"].ToString() ); Node.ForeColor = Color.Green; treeView1.Nodes.Add(Node); } Menu_count += 1; } SubSystem_count += 1; } System_count += 1; }
forach
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)