CODE Snippet
int i = 0;
foreach (DataRow row in DT.Rows)
{
Solution_Name = DT.Rows[i][0].ToString();
Table_Name = DT.Rows[i][1].ToString();
Column_Name = DT.Rows[i][3].ToString();
TreeNode SolutionNode = new TreeNode(Solution_Name);
TreeNode ColumnNode = new TreeNode(Column_Name);
TreeNode TableNode = new TreeNode(Table_Name);
if (Previous_Solution_Name != Solution_Name)
{
treeView1.Nodes.Add(SolutionNode);
SolutionNode.Nodes.Add(TableNode);
TableNode.Nodes.Add(ColumnNode);
Previous_Solution_Name = Solution_Name;
Previous_Table_Name = Table_Name;
}
***** The below code is executed but the NODE.ADD does not occur.
if ((Previous_Table_Name != Table_Name) && (Previous_Solution_Name == Solution_Name))
{
SolutionNode.Nodes.Add(TableNode);
TableNode.Nodes.Add(ColumnNode);
}
if ((Previous_Table_Name == Table_Name) && (Previous_Solution_Name == Solution_Name))
{
TableNode.Nodes.Add(ColumnNode);
Previous_Table_Name = Table_Name;
}
i++;
}
|