Implementing unlimited categories in the database

  • I'm trying to implement a table in my database that supports the creation of unlimited categories via asp.net front end, here's the structure thus far...

    id, category_name, parent_id

    is this correct cause logically? So in asp.net if I have a listview or some other component it should display like this...

    0

    -0_0

    -0_1

    -0_N

    -1

    -1_0

    -1_1

    -1_N

    -2

    -2_0

    -2_1

    -2_N

    -3

    -3_0

    -3_1

    -3_N

    -N

    -N_0

    -N_1

    -N_N

  • Can you be a little more specific? For example, will you have more than one level of parent/child hierarchy? Is this simply to populate a list box or drop down list? Etc. If you plan on having a complex parent/child hierarchy, then take a look at this article.

    http://weblogs.asp.net/aghausman/archive/2009/03/16/storing-retrieving-hierarchical-data-in-sql-server-database.aspx

  • Thanks for the reply SqlGeek. Yes I plan to have a complicated hierarchy using a listbox or any other component (.net) that can handle explorer type views. Thanks for the link, I'll check it out as it looks promising to what I'm trying to do.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply