Sql.Net Class Library Documentation

WhereTerm.CreateCompare Method 

Creates a comparison WhereTerm.

public static WhereTerm CreateCompare(
   SqlExpression expr1,
   SqlExpression expr2,
   CompareOperator op
);

Parameters

expr1
Expression on the left side of the operator
expr2
Expression on the right side of the operator
op
Conditional operator to be applied on the expressions

Return Value

A new conditional WhereTerm

Remarks

A comparison term compares two expression on the basis of their values. Expressions can be of any type but their results must be of comparible types. For instance, you can not compare a database field of type 'date' and a static value of type 'int'.

Example

...
query.WherePhrase.Terms.Add(WhereTerm.CreateCompare(SqlExpression.Field("name", tCustomers), SqlExpression.String("J%"), CompareOperator.Like));

See Also

WhereTerm Class | Reeb.SqlOM Namespace