Hi,
I am using DBFunctionCall in predicate expression.
The code is gn below
EntityField myField = ActivityHeaderFields.DatePerformed ;
myField.ExpressionToApply = new DbFunctionCall( "YEAR", new object[] { ActivityHeaderFields.DatePerformed } );
int[] values = new int[2] {2007, 2006};
predicateExpression.Add(new FieldCompareRangePredicate(
myField, null, values));
When i try to pass integer values i.e 2006 and 2007 , type cast error is throwing.
This is the error i am getting " An exception was caught during the execution of a retrieval query: Failed to convert parameter value from a Int32 to a DateTime.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception."
Runtime generate the FieldCompareRangePredicate variables as DateTime but from the code i am passing integer values. Please let me know how to overcome this situation.
Regards
Prabhu