1
另一個分配塊!Linq to SQL - 按訂單發佈
基本上問題是,我不能讓我的輸出按降序排列價格,同時按國家分組。
我知道這可能很簡單,但我似乎無法得到它。
任何解決方案?
謝謝!
這裏有一個問題:「6.允許用戶按降序排列按國家分組視圖的五大暢銷的產品 (10分)」
這裏是我的代碼:
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
var q6 = (from t in northwind.Products
orderby t.UnitPrice descending
join o in northwind.Suppliers on t.SupplierID equals o.SupplierID
group t.UnitPrice by new {o.Country, t.UnitPrice} into grouped
select new
{
Output = grouped.Key
}).Take(5);
lbxTop5.ItemsSource = q6;
}
在這個輸出端爲「System.Collections.Generic.List'1」 這對於摘要! – 2013-04-22 12:43:50