Jun 7, 2010

Open Access Exception : Please reformulate the query so that the parameter appears on the right side.

You may come up with this exception : Please reformulate the query so that the parameter appears on the right side. in Telerik Open Access

If you have something like:

query = query.Where(x => x.Positive == (positive ? 1 : -1));

The bolded text is an iif expression that the Open Access Linq driver cannot evaluate.

The solution is to use something like:

int iPositive = positive ? 1 : -1
This way the SQL will have the evaluated expression and will know how to deal with it.

NOTE: As far as I know this issue is fixed in the latest releases of Open Access ORM.