C# Linq到SQL-输出类型?(不显示信息,仅显示类型)
所以伙计们。。。我有一个问题: 以下是我的代码:C# Linq到SQL-输出类型?(不显示信息,仅显示类型),c#,sql,linq,C#,Sql,Linq,所以伙计们。。。我有一个问题: 以下是我的代码: var q6 = (from t in northwind.Products join o in northwind.Suppliers on t.SupplierID equals o.SupplierID group t.UnitPrice by new {o.Country, t.UnitPrice} into grouped let county = grou
var q6 = (from t in northwind.Products
join o in northwind.Suppliers on t.SupplierID equals o.SupplierID
group t.UnitPrice by new {o.Country, t.UnitPrice} into grouped
let county = grouped.Key.Country
let price = grouped.Key.UnitPrice
group new
{
Country = county,
Product = price
}
by county
into countryGrouped
select new
{
Output = countryGrouped.Key,
Price = countryGrouped.OrderBy(c => c.Product)
});
lbxTop5.ItemsSource = q6;
它可以输出价格
价格是这样的:
...
select new
{
Output = countryGrouped.Key,
Price = string.Join(",", countryGrouped.OrderBy(c => c.Product))
});
谁能告诉我如何以正确的格式而不是数据类型输出价格
谢谢 什么是“propper格式”
您可以这样做:
...
select new
{
Output = countryGrouped.Key,
Price = string.Join(",", countryGrouped.OrderBy(c => c.Product))
});
这将使输出成为逗号分隔的字符串这可能与您在controlDecimal上指定DISPALY字段和VALUE字段有关,但只要它显示出来,就没有什么区别!这个代码很有用!非常感谢。唯一的问题是它在重复一些数据,但我会解决这个问题!非常感谢。