Click here to Skip to main content
16,016,180 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two datatables in dataset ds.
in table[0] i have columns mnth, amount,month
it looks a like
HTML
mnth   amount1  month
 9      1500    sep
10     1700    oct
11     2200    nov

and in table[1] i have columns mnth,amount
it looks a like
HTML
mnth   amount2
4       1000 
7       1500
9       800

now i want to merge tables and want to diplay such like this
HTML
month amount1  amount2    
4               1000
7               1500
9       1500     800
10      1700
11      2200


here both table's amount is irrelevant.. i want that both the amount should display month wise.. if both tables have amount in 9th month then there should be only one row..

i tried merge() function but it didn't worked.
plz help me out..
Posted
Updated 30-Jan-12 2:48am
v2
Comments
Anuja Pawar Indore 30-Jan-12 8:48am    
formatting done

 
Share this answer
 
Comments
Amir Mahfoozi 30-Jan-12 5:47am    
+5
uspatel 30-Jan-12 5:48am    
Thanks Amir....
Try
dt.Merge()


Thanks
--RA
 
Share this answer
 
DataTable.Merge is not the right method, because merge processes data on row base. Instead of merge use LINQ if possible:

http://stackoverflow.com/questions/656013/linq-join-2-datatables-wildcard[^]
 
Share this answer
 
Comments
Member 8589824 30-Jan-12 4:56am    
okay.. but how can i join tables in c#?? this ans is for linq
 
Share this answer
 

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