S
SqlJunkies User
The subject about Parent-child retations in two comboboxes was discussed. Here I would like to ask (or may be share) some problems about this subject to find out the right way for this matter.
So, to be more concrete:
The first combo1 is connected to Manufacturers, the second combo2 is connected (or should be connected) to their respective products. Choosing the certain manufacturer in first combo1 should course the combo2 to be filled with the product list of this manufacturer.(actually several controls will also be filled with appropriate data from Products Table)
Here I am faced with the problem which database design to choose:
1. I can make one table only with manufacturers list with ID. I will have the saparate tables for the Products of each manufacturer with the same ID. After that I should somehow make a relations between ONE table with manufacturer list WITH MANY tables of their respective production list. I can use the ID, which will be the same in parent and child table and make the coding for appropriate action (I think that I can)
It is may be good approach, than the sitiation is "static". I mean the list of manufacturers does not change. But if I want to add a new manufacturer I should make an additional table for his products in run-time, fill this table and make the ralationship. It seems difficult to me.
2. Another approach is the following:
I can make the same Table with Manufacturer list as in first example. BUT there will be also ONLY one table called Products, where I will write all the products from all manufacturers with the respective ID, which will be the same as each Manufacturer has. So, when I choose the manufacturer from combo1, the combo2 will find all the products with the same ID (using some sql statement) and fill the combo2. There are no relations here. Just business logic of writen code.
Now what is the question actually. Which of this 2 approachs considered to be best.
AddInfo: the database is not large, maybe 10 manufacturers with 20 products from each.
Thank You in advance
David111
So, to be more concrete:
The first combo1 is connected to Manufacturers, the second combo2 is connected (or should be connected) to their respective products. Choosing the certain manufacturer in first combo1 should course the combo2 to be filled with the product list of this manufacturer.(actually several controls will also be filled with appropriate data from Products Table)
Here I am faced with the problem which database design to choose:
1. I can make one table only with manufacturers list with ID. I will have the saparate tables for the Products of each manufacturer with the same ID. After that I should somehow make a relations between ONE table with manufacturer list WITH MANY tables of their respective production list. I can use the ID, which will be the same in parent and child table and make the coding for appropriate action (I think that I can)
It is may be good approach, than the sitiation is "static". I mean the list of manufacturers does not change. But if I want to add a new manufacturer I should make an additional table for his products in run-time, fill this table and make the ralationship. It seems difficult to me.
2. Another approach is the following:
I can make the same Table with Manufacturer list as in first example. BUT there will be also ONLY one table called Products, where I will write all the products from all manufacturers with the respective ID, which will be the same as each Manufacturer has. So, when I choose the manufacturer from combo1, the combo2 will find all the products with the same ID (using some sql statement) and fill the combo2. There are no relations here. Just business logic of writen code.
Now what is the question actually. Which of this 2 approachs considered to be best.
AddInfo: the database is not large, maybe 10 manufacturers with 20 products from each.
Thank You in advance
David111