Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
There is one Datagridview. It has three columns like

FruitId | FruitPrice | FruitName
1 | 100 |
2 | 200 |
3 | 300 |

these value comes from table_FruitPrice
Now finally I want to display in third column FruitName by its FruitId that is presenting in column one and FruitName will come from Table_FruitName.


Please help anyone....

What I have tried:

......................................
Posted
Updated 2-Aug-16 20:16pm

1 solution

Hello ,
(Assuming that you are fetching records by Store Procedure or Sql Command and then showing records in DataGridView).

Before display the records in DataGridView , first join two tables named as 'table_FruitPrice' and 'table_FruitName' by FruitId and then show the record in DataGridView.

Sql Query will be
Select a.FruitId,  a.FruitPrice ,  b.FruitName from table_FruitPrice a inner join table_FruitName b on a.FruitId=b.FruitId 

Thanks
 
Share this answer
 
Comments
Member 12245539 3-Aug-16 2:42am    
Yes exactly

But I want a different this values work form laod event

FruitId | FruitPrice | FruitName
1 | 100 |
2 | 200 |
3 | 300 |

And I want to display by hitting on button

FruitId | FruitPrice | FruitName
1 | 100 | Banana
2 | 200 | Tomato
3 | 300 | Orange
Animesh Datta 3-Aug-16 4:10am    
why you want this type of approach ?
Member 12245539 3-Aug-16 4:38am    
because
Two more table are there in name of Storate_Table & Sale_Table. Storage_table has a fixed quantity. And Sale_table is containing only the products have been sold out.

Datagridview showing the remaining quantities and for this I have fixed a subtract formula to subtract.
Animesh Datta 3-Aug-16 7:10am    
but where is the problem with "FruitName" column ?

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