473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Loading a Treeview from database, infinite sub nodes

Ben
Hi

We have the below details:

Order_Base
CustomerNo, OrderNo, OrderItemNo.....

Order_Detail
OrderItemNo, ParentItemNo, Desc......

Order_Detail.ParentItemNo is a FK for Order_Base.OrderItemNo

There is also the ability for Order_Detail.ParentItemNo to relate to another
higher level record of Order_Detail.ParentItemNo

(dont blame me for the database design)

We want to display these details in a Tree View:

1Order_Base
2 Order_Detail which relates to Order_Base (Order_Detail.ParentItemNo =
Order_Base.OrderItemNo)
3 Order_Detail which relates to parent record Order_Detail
(Order_Detail.ParentItemNo = Order_Detail.OrderItemNo)
4 Order_Detail which relates to parent record Order_Detail
(Order_Detail.ParentItemNo = Order_Detail.OrderItemNo)
5 Order_Detail which relates to parent record Order_Detail
(Order_Detail.ParentItemNo = Order_Detail.OrderItemNo)
6 Order_Detail which relates to parent record Order_Detail
(Order_Detail.ParentItemNo = Order_Detail.OrderItemNo)

The problem I have is that the quantity of sub items could go on forever,
the sql select statement for level 3 and beyond should be identical with
only the parent variable changed.

I am having problems creating re-usable code so that I can loop though them
past stage 2, my code currenlty has selected all items at level 1 and two
and they are all there fine. but how do I continue from here?

Any help would be very much appreicated

Thanks
B
Feb 16 '07 #1
4 2146
Ben wrote:
The problem I have is that the quantity of sub items could go on forever,
the sql select statement for level 3 and beyond should be identical with
only the parent variable changed.

I am having problems creating re-usable code so that I can loop though them
past stage 2, my code currenlty has selected all items at level 1 and two
and they are all there fine. but how do I continue from here?
Let your User do the looping ....

If you start unravelling things to this sort of depth all in one go, the
vast majority of users are going to die of boredom.

If they want to drill down that far, by all means let them, and just
expand each level of the tree as they go.

HTH,
Phill W.
Feb 16 '07 #2
Ben
Thanks Phill

I sorted out of couple of levels of nodes and, as you say, started to die of
boredom!

How can I add the expansion pluses to each item to indicate to the user that
there maybe something below (before I have loaded them).

Thanks
B

"Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-kwrote in message
news:er**********@south.jnrs.ja.net...
Ben wrote:
>The problem I have is that the quantity of sub items could go on forever,
the sql select statement for level 3 and beyond should be identical with
only the parent variable changed.

I am having problems creating re-usable code so that I can loop though
them past stage 2, my code currenlty has selected all items at level 1
and two and they are all there fine. but how do I continue from here?

Let your User do the looping ....

If you start unravelling things to this sort of depth all in one go, the
vast majority of users are going to die of boredom.

If they want to drill down that far, by all means let them, and just
expand each level of the tree as they go.

HTH,
Phill W.

Feb 16 '07 #3
Ben
Actually Scap that, I will load the window with 2 levels and then load a
subsequent one level on each expansion.

Thanks for your help.

B
"Ben" <Be*@Newsgroups.microsoft.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Thanks Phill

I sorted out of couple of levels of nodes and, as you say, started to die
of boredom!

How can I add the expansion pluses to each item to indicate to the user
that there maybe something below (before I have loaded them).

Thanks
B

"Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-kwrote in message
news:er**********@south.jnrs.ja.net...
>Ben wrote:
>>The problem I have is that the quantity of sub items could go on
forever, the sql select statement for level 3 and beyond should be
identical with only the parent variable changed.

I am having problems creating re-usable code so that I can loop though
them past stage 2, my code currenlty has selected all items at level 1
and two and they are all there fine. but how do I continue from here?

Let your User do the looping ....

If you start unravelling things to this sort of depth all in one go, the
vast majority of users are going to die of boredom.

If they want to drill down that far, by all means let them, and just
expand each level of the tree as they go.

HTH,
Phill W.


Feb 16 '07 #4
All you need to do is add a "dummy" node. That node will ensure that the
GUI shows the expand "+". Then when you get an expand event you check and
if the only node existing is the "dummy" node then you delete the "dummy"
node and then populate the expanded node. If there are no items to be
populated your user will see an empty tree node.

Easy to do and will make you app much faster.

Lloyd Sheen
"Ben" <Be*@Newsgroups.microsoft.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Thanks Phill

I sorted out of couple of levels of nodes and, as you say, started to die
of boredom!

How can I add the expansion pluses to each item to indicate to the user
that there maybe something below (before I have loaded them).

Thanks
B

"Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-kwrote in message
news:er**********@south.jnrs.ja.net...
>Ben wrote:
>>The problem I have is that the quantity of sub items could go on
forever, the sql select statement for level 3 and beyond should be
identical with only the parent variable changed.

I am having problems creating re-usable code so that I can loop though
them past stage 2, my code currenlty has selected all items at level 1
and two and they are all there fine. but how do I continue from here?

Let your User do the looping ....

If you start unravelling things to this sort of depth all in one go, the
vast majority of users are going to die of boredom.

If they want to drill down that far, by all means let them, and just
expand each level of the tree as they go.

HTH,
Phill W.

Feb 16 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Eric Promislow | last post by:
Has anyone else run into this? The problem is that I'm loading one schema at a time, to be displayed in a TreeView. Each node in the tree points to an item in the schema via the Tag property. ...
3
by: Jan Wrage | last post by:
Hi! I would like to implement a treeview in my existing application. It should show my entire Active-Directory structure, i.e. all Groups, Containers and OUs. Could somebody help me with...
7
by: vsiat | last post by:
I am trying to create a treeview out of a database table with the typical structure ID, NAME, PARENTID, TYPE, EXTRA_INFO, where is linked to the . What I want to achieve is create a tree made...
3
by: Troy | last post by:
I've almost got this the way I want it. I'm loading my customer names into a treeview control. My problem is I'm repeating my root nodes. I know it's something to do with my loop structure but My...
1
by: SeVeN | last post by:
Hello All, I am having a problem loading nodes and child nodes into a treeview from an access database. My Db fields are as follows : ID NodeName ParentID
1
by: Medes | last post by:
Hi, I am trying to load my items from Database to a Treeview but i have faild My table contains id, parentId, nodeName like following: (1 , 1 RootNode) (2 , 2 , ParentNode)
1
by: icfai | last post by:
hi friends.... I have got a problem regarding loading of multiple assemblies, actually its required for an editor which implements the intellisenseas in vb or dotnet. for that it is required to...
6
by: A.Weinman | last post by:
Hello all, I have an application that has multiple forms, only 3 of which matter for this issue. There is a main form that starts invisible and does nothing more than start other forms and link...
1
by: adstheman | last post by:
Hi all, I'm testing new versions of our suite of software products on different Windows platforms and found this strange problem the other day. When running the test release on a clean Windows...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.