|
-
Sep 12th, 2001, 08:23 AM
#1
Parent child Records using ADO
I am using Visual Basic 6 as front end and Sql server as a Back end, and Ado 2.5.
In my table there are 2 columns one is a Parent and second is a child. Suppose partendID 1 is there in parent col it will appear multiple times in parent col for it’s all child entries. Then that parentID 1 will be prensent in child col also because it’s a child of some other parentId. I have now TopMost hierarchy of the recordset. Now in a loop I have to find the children of all the branches of the Tree. I am having great difficulty in doing this. I would greatly appreciate your help. Once I get all the records in this hierarchy I have to write them in a word file in a index format. And referencing on which page details of that record will appear.
Top 1---------------
A( Top1’s Child 1)------------------
A1 ( A’s child1)
A2 (A1’s Child1)
B2 ( A1’s Child 2)
B1 ( A’s Child 2)
A2 (B1’s Child1)
B2 ( B1’s Child 2)
B( Top1’s Child 2)
And So on -----
Top 2------------------------
And so on -----
Top3---------------------
And so on-------------------
I have to show all these records in this format I have the values for the Top 1,2,3 and ---all and now with these values I have to find the values for each and every branches until it’s end node in loop and write them to wordfile.
Any help is appreciated.
Thanks.
Anagha
-
Sep 13th, 2001, 02:12 AM
#2
hmmm
This might be too easy to be correct but, if your table has ids use the query and sort by the parent id first then by the child.
This should result in the desired recordset which you loop through outputting to word (direct or to a text file).
Something like :
select Table.parentid, table.childid from table order by parentid,childid;
Any use?
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Sep 13th, 2001, 02:32 AM
#3
Parent-Child
Hey Anagah,
try using SHAPE command of VB.
U can search it in MSDN. That is better for hierarchial displays.
Let me know it what happened?
Excel Luck
Harish H.R.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|