im using asp.net with vb.net.
i have a situation, there are two drop down list, 1)Car Model 2) Car Colours. A set of specific colours would fill up the second dropdown list based on the Car Model choosen on the first drop down list.
my question is how do i create a database table that enables me to extract the specific colours based on the car model chosen?.How to create database to accomodate this kinda specific info?
hope to get some feedback here.thank you.Hi
There are two ways to go about this and I suppose the option you choose to take will depend on how normalized you want your database to be.
OPTION 1:
----
One Entry for each individual car in the car table
Car Table
--> CarID
--> CarDescription
One entry for each combination of car/colour in the colour table.
Colour Table
--> ColourID
--> ColourDescription
--> CarID (Foreign Key)
Thus you might have 15 entries for the colour blue, but each of these entries will have a different CarID (i.e. the cars that are available in blue). When the car selected is then say the car with CarID 10, populate the colour dropdown with each colour from colour dropdown that has a CarID of 10.
OPTION 2:
----
One Entry for individual car in the car table
Car Table
--> CarID
--> CarDescription
One Entry for individual colour in the colour table
Colour Table
--> ColourID
--> ColourDescription
And then a third table that maps CarID's to ColourID's:
Car_Colour Table
--> CarID (Foreign Key)
--> ColourID (Foreign Key)
Now when CarID 10 is selected in the car dropdown, populate the colour dropdown with each colour that is mapped to CarID 10 in the Car_Colour table...
HTH|||Dear Daily...
Thanks a heap!!!...really appreicate it..:)
No comments:
Post a Comment