Click here to Skip to main content
14,734,319 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Pl. suggest me database design for making multi level categories. I am making website which has features similar of shopping site and functionalities as below.

1) Categories falling in more than one parent category and at different levels e.g. "Banana" and "Apple" can fall in "fruits" at level 2 and similarly can fall in "health products" at say level 3.

2) Also have functionalities like "suggested categories" or "similar categories".

It would be further help if someone can also suggest the best and latest way to implement using and C#. I mean should I use Linq or simple ASP.Net as it should be optimised for mobile browsers also.

1 solution

You seem fairly confused. No browser will care if you used LINQ, why would it ? Perhaps you need to do some reading to understand what ASP.NET is, and what it does. It creates HTML for your browser, the C#, with or without LINQ, only runs on the server.

The obvious way to do this, is for each category to have an id, and to also store the id of it's parent. This will then go as deep as you want it to.
amitjind 4-Jul-10 1:27am
Hi Christian..thanks for the reply. Let me describe it in more depth leaving Linq as I know that runs in the background. My main requirement is how to design database where I can link a category at any level of hierarchy so that category in the database can be linked to many categories without repeating. Second how we implement functionality of "similar or suggested categories " which most of the sites show as suggestion.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900