0
我使用linq分組數據,從以下代碼中可以看到,組我希望在組數據上交換並添加到另一個表。使用不同的行使用Linq
但我只得到InvoiceHeader.Key,我不知道如何獲得其他領域
DataTable VendorInvoiceStagingTable;
DataTable VendorInvoiceTable;
VendorInvoiceStagingTable = new Program().ReadExcelFile(@"C:\Users\huzaifa.gain\Desktop\Vendor invoice import - sample data set.xlsx", "Sheet2");
var InvoiceHeadercollection = from row in VendorInvoiceStagingTable.AsEnumerable()
group row by row.Field<string>(VendInvoice.Number) into grp
select grp;
VendorInvoiceTable = new Program().CreateHeader();
foreach (var InvoiceHeader in InvoiceHeadercollection)
{
VendorInvoiceTable.Rows.Add(InvoiceHeader.Key, .....
}
http://stackoverflow.com/questions/5762176/casting-into-grouping-row – Gainster 2011-04-23 08:30:10
這是行不通的 – Gainster 2011-04-23 08:30:27
@huzaifa它將幫助回答你的問題,如果你說明它爲什麼不適合你。您提到的帖子有不同的問題 – 2011-04-23 09:24:06