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
What is the purpose of session management?
Which library is used by the testers and developers to develop automated tests and create testing tools?
What is asp.net futures?
How do you declare static variable? What is its lifetime?
What is Partial PostBack in ASP.NET?
What is asp.net localization?
How can you implement the postback property of an asp.net control?
Are xaml file compiled or built on runtime?
Explain what is clr?
Can you set which type of comparison you want to perform by the comparevalidator control?
What does the hotspot class in .net do?
What is the use of placeholder control? Can we see it at runtime?
What is rending process in ASP.NET?
Differentiate strong typing and weak typing
What are the new web part controls in asp.net 2.0 ?