المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How to combine two datatables into single datatable



C# Programming
12-05-2009, 03:11 PM
Hi all,

I am trying to combine two datatables into single datatable...

First table contains 3 columns[e.g: 'col1','col2','col3']
Second table contains 2 columns[e.g: 'col4','col5']

Both tables have the same no.of records[rows], but different columns.
How to combine them into single table?

I need DataTable with columns ['col1','col2','col3','col4','col5'].

I am inserting through looping the both the tables and adding values into third table.

I tried the Merge (DataTable.Merge()), but it is adding the records to bottom of first one, but i need it should be added to the side[as columns] to first table'

Is there any other way? please suggest me.

Thanks in advance.