Solved

TreeView Population from SQL Database

Posted on 1998-11-13
3
282 Views
Last Modified: 2010-04-04
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
Comment
Question by:evansj
  • 2
3 Comments
 
LVL 2

Expert Comment

by:freter
ID: 1346742
Check out the TDBTreeView by Kiew Software Factory (http://www.ksf.kiev.ua)

rgds Freter
0
 
LVL 1

Accepted Solution

by:
Edo082297 earned 200 total points
ID: 1346743
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
 
LVL 1

Expert Comment

by:Edo082297
ID: 1346744
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now