Click here to Skip to main content
15,886,530 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends
I am developing a medical management project. In that I have following tables
Table 1) Components_details
fields: 1. Component_id ,2.Component_name ,3.Uses Of componenets
Table 2) Medicine_Details
fields: 1. Medicine_id ,2.Medicine_name,3.Uses of medicines
suppose I want to add many components for creating medicine, in that situation I need to select multiple components for single medicine with their percentage to make a medicine. how can i store combination details for single medicine.please help me.
thank you
Posted

1 solution

Hi,

Do you know about Master detail table structure?
You can make one detail table with your Medicine_id. That table can be like this :

SQL
TableName : Medicine_Components_Details
1. MCDID(PK)
2. Medicine_id
3. Component_id


So here you can get all Components for 1 Medicine.
I hope this information help you.

Thanks,
Viprat
 
Share this answer
 
Comments
tanweer 9-Oct-12 1:32am    
good answer, 5+
VIPR@T 9-Oct-12 1:38am    
Thanks :)
baskaran chellasamy 9-Oct-12 1:44am    
thank you for your valuable suggetion. The table you are given is N:M relationship. Is it correct? what is my doubt is In application design I just given one medicine id and select multiple checkboxlist value for combination to store in this medicine-components-details.In that situation how can store value in database
VIPR@T 9-Oct-12 1:57am    
Yes you can do this way. See Components_Details is your one Master table. Now when you create medicine you are using multiple components. So for that you can store the values in 2 different table. 1)Medicine_Details Which contains the medicine name. and the other table is 2)Medicine_Components_Details(Which i mentioned). Here you can save your medicine ID and component ID. So for any medicine contains with which Components, that details you will get from this table. I hope you can get the idea.
baskaran chellasamy 9-Oct-12 2:16am    
Yes I got your idea. but please help me for the following situation.
as You mentioned.
The table format could be like this

MCID Medicine_id Componenets id
1 11 101
2 11 102
3 11 103
4 12 101
5 12 104
The situation is (in application design)
TextBox value for One medicine (11) and checkboxlist for components (101,102,103) . How can add same medicine value for single insertion for medicine table and multiple insertion for medicine_component table with many checkboxlist.

But In design

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