Я следующую таблицу структуру:LinQ Group.Average обрезает мои ценности
tempDt
col1 = Product (Integer)
col2 = Customer (Integer)
col3 = Center (Integer)
col4 = Date (Date)
col5 = Price (Double)
col6 = Sales (Double)
Этот пример строки:
1;1;1;01.01.2012;4.39;20000
1;1;1;02.02.2012;4.46;15000
1;1;1;03.03.2012;4.22;25000
И следующий Linq запрос:
For Each item In From u In tempDT.AsEnumerable
Group u By Product = u("Product"), Customer = u("Customer"), Center = u("Center") Into Group
Select Product, Customer, Center, Price = Group.Average(Function(g) g("Price")), Sales = Math.Round(Group.Sum(Function(g) CDbl(g("Sales"))), 2)
tmpDt.Rows.Add(item.Product, item.Customer, item.Center, item.Price, item.Sales)
Next
Но в результате I ge t следующая строка: 1; 1; 1; 4.0; 60000
Группа. Усекает колонку «Цена», что не так?
Спасибо, это решить мою проблему. – user1434532