Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 290
  • Last Modified:

TreeView Population from SQL Database

How would you go about populating the TreeView component from an Oracle Table? I would like to be able to have say OWNER as node and all TABLE_NAME as children, and COLUMN_NAME as the 3rd node. I don't want the OWNER displayed but once.
0
evansj
Asked:
evansj
  • 2
1 Solution
 
freterCommented:
Check out the TDBTreeView by Kiew Software Factory (http://www.ksf.kiev.ua)

rgds Freter
0
 
Edo082297Commented:
Hello
  When you add a node to a treeview, if you pass nil in the parameter for the constructor of that node, it will be created at 'the root'. After that, when you pass a node in the constructor for other nodes, the nodes will appear as children of the node passed in. And so on (is this clear?). Here is some pseudo-code to get you on your way:

OpenTable

// TableNames is of type TTreeNode
Tables := Tree.Items.Add(nil);

for AllRecords do
begin
  // Add a table with the first node (Tables) as the parent
  ATable := Tree.Items.Add(Tables);
 
  for AllFieldsInATable do
  begin
    // add column nodes to the new ATable node
    AColumn := Tree.Items.AddChild(ATable);
    AColumn.Text := FieldName;
  end;
end;

This pseudo-code assumes that you have an Oracle table with all of your table names in it (did I understand that correctly?).
 
TTreeView is a sophisticated, powerful component. This should be enough to get you on your way.

Regards,
Edo

0
 
Edo082297Commented:
Oh, fudge. The Add method up there takes two parameters, and should read AddChild anyway. I hope you get the idea anyway.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now