如何在C#中合并来自DataTable的行数据?
答案 0 :(得分:1)
我认为这是LINQ Group clause的一个很好的用例。你可以从这样的事情开始:
var rowGroups = dataTable.Rows.GroupBy(row =>
new {RecptNo = row["recpt_no"], Test = row["Test"]});
foreach(var group in rowGroups)
{
//Here "group" is a collection of rows with the same rectp_no and test. Process as required.
//You could also check group.Key.RecptNo and group.Key.Test here if necessary.
}
答案 1 :(得分:0)
这是与您的问题相关的链接。希望它有所帮助。
How to merge rows in a DataTable when data in multiple columns match?