Solved

TreeView Population from SQL Database

Posted on 1998-11-13
3
283 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

947 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

21 Experts available now in Live!

Get 1:1 Help Now