Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
My code accesses a SQL Server database using DevExpress XPO. It contains the following query: var relevantAccount = accounts .Where(acc => String.Compare(acc.Description, "Some Account Nam...
#1: Initial revision
LinQ expression not supported in the `Where` clause
My code accesses a SQL Server database using DevExpress XPO. It contains the following query:
var relevantAccount = accounts
.Where(acc => String.Compare(acc.Description, "Some Account Name", true) == 0)
.FirstOrDefault()
;
I use `String.Compare` rather than `==` so I can do a case-insensitive comparison. It compiles, but throws an Exception during runtime:
> System.NotSupportedException: 'The expression is not supported in the Where clause: Compare(acc.Description, "Some Account Name", True)'
Why does this `Where` clause throw an Exception, and how do I fix it?
