I am having difficulty with recursive hierarchies. I would like to have unlimited categories and subcategories displayed in a breadcrumb inside a drop down box for the entire table. My table is tblCategories and it has a ID and Parent ID field in the database. Any help would be greatly appreciated. I am really struggling and don't quite understand the mathematics behind it. Here is the code I came up with, but its not working:

Thank you my friend for taking the time to help. I've googled myself to death looking for an answer to my problem. Here is how my database is setup. It has other fields, but the important ones are as follows:

ID ParentID Name
1 0 Pets
2 1 Cats
3 2 Siamese Cats

I am trying to get this:

Pets >> Cats >> Siamese Cats

I am new to ASP and SQL. I am not very familiar with JOINS.

My output looks good until I get to the third node, then it craps out.

The output looks like this when I try to add Siamese Cats to Cats:

Pets
Pets >> Cats
Cats >> Siamese Cats

It should look like this:

Pets
Pets >> Cats
Pets >> Cats >> Siamese Cats

If you have the time, could you please comment you code a little more to show me exactly what you are doing and/or show me how I would incorporate this code into my sample to get the drop down select box to work? Thank you. Your time is greatly appreciated.