Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WPF LINQ
Hai All,
 
How we can combine two datatable into one, both fields are same type ie, name & number fields are string type.
ie table1 + table 2 = table3;
table1 contain field name as name
and table2 contain field name as number
but i need table3 as name, number. plz refer the image below..
 

refer this image http://snag.gy/jshtM.jpg[^]
Posted 12-Dec-12 21:46pm
Edited 12-Dec-12 22:15pm
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

use datatable.merge(//other datatable)..
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Don't tell us that it's urgent that you can't do your job.
 
Depending on what you mean by 'table', you can join tables in SQL, you can copy data from one table to another, or you can just create a collection of objects that includes the data from both tables.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Create a new table that contains two columns ,then get the value from the other tables .
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

One of the easiest ways is to use natural join.
 
The SQL NATURAL JOIN is a type of equi-join and is structured in such a way that, columns with same name of associate tables will appear once only.
 
For example:
SELECT * FROM table1 NATURAL JOIN table 2;
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Kornfeld Eliyahu Peter 169
1 Zoltán Zörgő 139
2 George Jonsson 135
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 13 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100