In my application's search function, I have implemented a search function which executes the following statement against the database.
resultsquery = db.DBMovies.Where(m => (m.Actors.ToLower()).Contains(q.ToLower()))
In the part q.ToLower()
I read the url parameter q
and converts into lowercase and find it in the relevant database column. In my database, the column 'Actors' is of type 'text' rather than varchar. When I run my application, I get an exception called Argument data type text is invalid for argument 1 of lower function
. Is there any way that I can avoid this exception? I prefer a way that I can solve it in a single line.
Thank you.