allList = allList.Where(c => isAdvertSearchable
&& c.tblAdvert.AdvertTitle.ToLower().Trim().Contains(param.sSearch.ToLower())
|| isTranastionTypeSearchable
&& c.IsActive.ToString().ToLower().Trim().Contains(param.sSearch.ToLower())
|| (c.Amount.ToString().ToLower().Contains(param.sSearch.ToLower().ToString())
|| param.sSearch == "")
|| isTranastionIDSearchable
&& c.TransactionId.ToLower().Trim().Contains(param.sSearch.ToLower())
Asked
Active
Viewed 401 times
1

Mihai Dinculescu
- 19,743
- 8
- 55
- 70

Krishna Ballavi Rath
- 302
- 3
- 9
-
try to put code with in { } brackets – shankar.parshimoni Dec 15 '14 at 05:28
-
possible duplicate of [LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression](http://stackoverflow.com/questions/5899683/linq-to-entities-does-not-recognize-the-method-system-string-tostring-method) – GraemeMiller Mar 02 '15 at 13:15
1 Answers
1
LINQ is complaining about not being able to translate ToString
to T-SQL.
Use
SqlFunctions.StringConvert(param.sSearch.ToLower())
SqlFunctions Class
Provides common language runtime (CLR) methods that call functions in the database in LINQ to Entities queries.
http://msdn.microsoft.com/en-us/library/system.data.objects.sqlclient.sqlfunctions(v=vs.110).aspx

Mihai Dinculescu
- 19,743
- 8
- 55
- 70