开发者

C# join 2 DataTables without LINQ

开发者 https://www.devze.com 2023-02-18 22:14 出处:网络
I want to join two data tab开发者_JS百科les 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

I want to join two data tab开发者_JS百科les 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, i.e.

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

HTH

Ivo Stoykov

0

精彩评论

暂无评论...
验证码 换一张
取 消