How to merge 2 tables fields in DataTable in asp.net

Answer Posted / sunil kumar

DataTable dt1 = retDT("select col1,col2 from Table1");
DataTable dt2 = retDT("select col3,col4 from Table2");
dt1.Merge(dt2);

retDT is a funtion to return datatable based on the query.

The output will be like below
if you check the dt1 content then the output will be

col1 col2 col3 col4
1 2 3 4

Is This Answer Correct ?    21 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why we use asp.net for website development?

486


Describe Segmentation With Paging?

617


Differentiate between a page theme and a global theme?

516


What are the different types of validation controls in asp.net?

513


What are the differnt types of handler in ASP.NET?

523






Where the cookie value is stored?

499


What is mvc in asp.net tutorial? : Asp.Net MVC

534


What is a web pool?

574


How to rename a table using sql queries?

558


What are the different methods of session maintenance in asp.net?

517


What is meant by ispostback in asp net?

529


What is asynchronous call?

566


What are the memory-mapped files?

512


What is the difference between a candidate key and primary key?

511


What is syntax code to send email from an asp.net application?

514