我有一个DataTable
的产品。每个产品都有重量和返回地址。 返回地址由7个字段组成。Linq为不同地址的总和
我需要循环浏览不同的地址并总结产品的总重量。
示例表是这样的......
Product weight address1 address2 address3 city state postcode country
A123 6 House 1st Street some place a city a state AB1 2CD GB
A456 3 House 1st Street some place a city a state AB1 2CD GB
A789 4 House 1st Street some place a city a state AB1 2CD GB
A123 6 House2 2st Street another place another city another state EF2 3GH GB
A456 3 House2 2st Street another place another city another state EF2 3GH GB
A789 4 House2 2st Street another place another city another state EF2 3GH GB
我有2个地址返回的13
的重量,我只用了地址字段(不是产品),并和需要组地址的重量。我也需要归还这个国家以及总计的重量。
这可能使用linq?或者我会更好地使用DataTable
上的SqlDataAdaptor
? 我知道我可以如何处理SqlDataAdaptor
,但我不知道如何处理Linq,我猜linq会更适合开销?
它可以使用LINQ可以做到,但问题是:你尝试过什么? – MarcinJuraszek 2013-03-18 10:28:53