0
我有一个web服务,返回一个十进制值到我的json字符串,但它取而代之的数字是400.00到400,但如果它有400.50它返回400.50这就是我要我如何在格式webservice返回舍入数字而不是小数
错误
{"Message":"LINQ to Entities does not recognize the method \u0027System.String ToString(System.String)\u0027 method, and this method cannot be translated into a store expression.","
代码
Products = ( from p in db.Products where p.DepartmentId == qDepartment.Id join i in db.ProductImages on p.Id equals i.ProductId into products from x in products.Where(y => y.Dimension == "180X180") select new Product { Id = p.Id, Title = p.Title, ShortDescription = p.ShortDescription, Brand = p.Brand, Model = p.Model, Image = x.Path, FriendlyUrl = p.FriendlyUrl, SellPrice = p.SellPrice.ToString("N2")/*Error Here changed type to string*/, DiscountPercentage = p.DiscountPercentage, Votes = p.Votes, TotalRating = p.TotalRating }).ToList();的值是400回到400.00
我试过你的例子,但我得到一个Linq To Entities错误在我的代码你知道什么可以做的工作 – ONYX
我也试过Convert.ToString()同样的问题 – ONYX
啊,我不知道你在使用LINQ to Entities - 让我们看看我们现在可以做些什么,现在我们已经有了这一点的信息以及 –