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;
相关文章推荐
- how to select data in multiple datatables after using join,group by and order by in Linq
- Convert.ToInt32()、Int.Parse()、Int.TryParse()和(int)
- Convert.ToInt32、(int)和int.Parse三者的区别
- C#中 int int.parse() 和convert.ToInt()的区别
- How to query_posts using meta_query to orderby meta_key AND have a secondary sort by date?
- HOW TO ORDER BY A CUSTOM SQL FORMULA/EXPRESSION WHEN USING HIBERNATE CRITERIA API
- Convert.ToInt32、(int)和int.Parse三者的区别
- C#学习笔记8-整型的三种强制转换int、int.Parse()和Convert.ToInt32()
- c#中(int)、int.Parse()、int.TryParse、Convert.To
- Int.Parse与ConvertToInt的区别
- c#中(int)、int.Parse()、int.TryParse()、Convert.To
- Convert SVG to PDF by using iText in Java(ZT)
- Convert SVG to PDF by using iText in Java(ZT)
- Step By Step guide to Read XML file in Java Using SAX Parser Example
- 字符串转换为数字:String:convert a string to int
- 读Excel表格的两个函数ALSM_EXCEL_TO_INTERNAL_TABLE、KCD_EXCEL_OLE_TO_INT_CONVERT
- Implementing Sugarcrm: A Step-by-step Guide to Using This Powerful Open Source Application in Your B
- How to Simulate the Price Order or Price Line Function using API QP_PREQ_PUB.PRICE_REQUEST Includes
- ManyToMany OrderBy
- Solutions to terminal problems encountered while using Python to execute "airodump-ng"