Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Displaying messages based on heirarchy


Message #1 by "behrang abadi" <babadi@c...> on Sun, 26 Jan 2003 03:18:49
We have an employee directory that I would like to be made viewable by 
department. I have a departments table with the following fields:

Department_ID (PK)
Department_Name 
Parent_ID

I can list all of the divisions, my problem comes in when I have child 
divisions, for example:

Department 1 is a top level department
Department 2 is a child of department 1
Departemtn 3 is a child of department 2
Department 4 is another top level department

What I want to is list them exactly as they appear above, eg

<UL>
<LI>Department 1</LI>
<UL><LI>Department 2</LI>
<UL><LI>Department 3</LI></UL>
</UL></UL>
<UL>
<LI>Department 4</LI>
</UL>

It's easy for me to get the top level (parent_id will be null for these) 
and I can easily get the first level. Its level 3 and beyond that I'm 
having problems with. I'm looking for an all VBScript solution if 
possible. 

Thanks. 

  Return to Index