I use the following Linq Query:
var projectList = from p in dbContext.vw_Projektkontrolle
where p.TXT_Adress1.Contains(filterTxt)
orderby p.TXT_Name
select p;
My projectList
is always null. In the debugging I can see, that filterTxt
is for example "testcompany".
Is the Contains method still in use in EF 6 or is there any work around?
I pass the filterTxt
via Form Post to the Action Method in my MVC application.
how to fix this issue.
EDIT: it works when I use just one
char
f.ex: "a" asfilterTxt
.But
TXT_Adress1
andfilterTxt
are both declared as strings
String.Contains method translates to:
CHARINDEX(ShowTypeDescriptio, @showTypeDescription) > 0
Might try to use lower case:
var projectList = from p in dbContext.vw_Projektkontrolle
where p.TXT_Adress1.ToLower().Contains(filterTxt.ToLower())
orderby p.TXT_Name
select p;
And even if it works you might face Turkey Test issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With