简体   繁体   中英

C# join 2 DataTables without LINQ

I want to join two data tables using C# without using LINQ. How can I do it?

Are you trying to concatenate two datatables to a new one? If so, do this

DataTable result= table1.Copy();
result.Merge(table2);

where table1 and table2 are DataTables

use a single statment that joins the tables in SQL, ie

select * from table1 t1, table2, t2 where t1.id = t2.id

HTH

Ivo Stoykov

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM