Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello. I am trying to combine two data table into a single data table.
My first data table consist of
USN    |Name    |Father Name   
001     abc      ABC
001     abc      ABC

My second data table consist of
CC     |Sem  |Marks
Sub01   3     78
Sub02   3     56

Now, I want to combine those tables into one. So my result will look like as follows
USN    |Name    |Father Name   |CC     |Sem  |Marks
001     abc      ABC            Sub01   3     78
001     abc      ABC            Sub02   3     56


Please help. Thank you
Posted
Updated 26-Apr-15 3:57am
v2
Comments
[no name] 26-Apr-15 8:47am    
What you have tried so far?
partha143 26-Apr-15 8:50am    
I tried merging the two datatables which result was as follows:
USN |Name |Father Name |CC |Sem |Marks
001 abc ABC
001 abc ABC
Sub01 3 78
Sub02 3 56
But the result which I am looking for is stated in my main question. Please help.
Sascha Lefèvre 26-Apr-15 9:49am    
Usually you do a join on a column with a common value. In your case there doesn't seem to be such a column. Do you want to join row1 to row1, row2 to row2 etc ?
partha143 26-Apr-15 10:06am    
I am developing a result sheet for my college, where student is asked to enter their reg num(USN) and it has to pull out the result for that reg num. So I am fetching USN,Name and Father Name into one datatable and CC,Sem and Marks into second datatable and joining those data as I have stated in my main question and lastly displaying the content of the final data in a gridview.
Sascha Lefèvre 26-Apr-15 10:08am    
Alright, but that doesn't really answer my question :)
Could you fetch the USN also from the second table?

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