How to combine two data tables?

I just am getting a situation to combine two data tables. Actually in my end, I had two datasets with two data tables in each of them. I needed to combine first data table in first dataset with first data table in second dataset. Similarly second data table in first dataset to second data table in second dataset.

On that moment I just found the way to merge data tables by using DataTable.Merge() method.

Then I combined my data tables as follows,

ds1.Tables[0].Merge(ds2.Tables[0], false,MissingSchemaAction.Add);
ds1.Tables[1].Merge(ds2.Tables[1], false, MissingSchemaAction.Add);

return ds1;


N.B: Here ds1 is first dataset, ds2 is second dataset.

...S.VinothkumaR.

1 comment:

qizhigang said...

Exactly what I'm looking for!!! Thanks a lot for sharing your work!

John