您的位置:首页 > 产品设计 > UI/UE

linq query, using int.parse to convert varchar to int while orderby

2014-02-16 10:39 387 查看
var t = from x in context.NewsLetterItem.ToList() //add .ToList at this place
where x.APPId == appid &&
allowedAddress.Contains(x.mailFrom)
orderby int.Parse(x.mailId) descending
select x;


else, if you use the following query, an erro with following message would be thrown:

LINQ to Entities does not recognize the method 'Int32 Parse(System.String)' method, and this method cannot be translated into a store expression.

var t = from x in context.NewsLetterItem
where x.APPId == appid &&
allowedAddress.Contains(x.mailFrom)
orderby int.Parse(x.mailId) descending
select x;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: