I have the following code:
var items = db.Name.Where(x => x.Forename.IndexOf("john", StringComparison.OrdinalIgnoreCase) >= 0).Take(20);
Where db
is a System.Data.Linq.DataContext
.
This gives me the lovely error of:
The translation of String.IndexOf to SQL does not support versions with a StringComparison argument.
All I want to do is compare a string in a database to one entered by a user (in the example above hardcoded as "john") but not take into account the case sensitivity. I based the code off the following question Case insensitive 'Contains(string)'