I have been following the Contoso University tutorial on the ASP.NET website. I am trying to expand my skills and so decided to try adding a third option to the filter. The tutorial provides:
if (!String.IsNullOrEmpty(searchString))
{
students = students.Where(s => s.LastName.ToUpper().Contains(searchString.ToUpper())
|| s.FirstMidName.ToUpper().Contains(searchString.ToUpper()));
}
Let's say I've got a third column called Nickname. I tried adding this to the filter by adding an additional || operator:
if (!String.IsNullOrEmpty(searchString))
{
students = students.Where(s => s.LastName.ToUpper().Contains(searchString.ToUpper())
|| s.FirstMidName.ToUpper().Contains(searchString.ToUpper())
|| s.Nickname.ToUpper().Contains(searchString.ToUpper()));
}
When I run with the third option added I get:
[SqlException (0x80131904): Argument data type ntext is invalid for argument 1 of upper function.]
What am I missing here? What do I need to learn next to help me understand more about what's happening here?