Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Linq到SQL-输出类型?(不显示信息,仅显示类型)_C#_Sql_Linq - Fatal编程技术网

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字段有关,但只要它显示出来,就没有什么区别!这个代码很有用!非常感谢。唯一的问题是它在重复一些数据,但我会解决这个问题!非常感谢。