I want to create a query which has more than 3-4 Expression.Or ? But Expression.Or just let me to add two Expressions inside it.
if (!string.IsNullOrEmpty(keyword))
query
.Add(Expression.Or(
Expression.Like("Name", keyword, MatchMode.Anywhere),
Expression.Like("LastName", keyword, MatchMode.Anywhere)))
.Add(Expression.Or(
Expression.Like("Email1", keyword, MatchMode.Anywhere),
Expression.Like("Email2", keyword, MatchMode.Anywhere)));
The code above generates "Name like %this% or LastName like %this% AND Email1 like %this% and Email2 like %this.
Thanks in advance.
Syntax is the set of rules by which the words and symbols in an expression are correctly combined. Initially, expressions in Access are a little bit hard to read. But with a good understanding of expression syntax and a little practice, it becomes much easier.
JavaScript's expression is a valid set of literals, variables, operators, and expressions that evaluate to a single value that is an expression. This single value can be a number, a string, or a logical value as depending on expression.
Use Disjunction instead of Or.
You can also use || instead of Or( ) or Disjunction( ).
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