Walaa wrote:
I'm not sure but I think you need to do this instead:
Filter.AddWithOr(monthFilter);
You want the predicates OR-ed not And-ed...right?
Please examine the generated SQL for better troubleshooting.
Hi walaa,
Thanks for reply. i got solve that problem, but now i am facing one more problem :
CmsArticlesCollection art = new CmsArticlesCollection();
PredicateExpression Filter = new PredicateExpression();
for (int year = 2008; year <= 2008; year++)
{
for (int i = 1; i <= 12; i++)
{
IPredicate monthFilter = new EntityField("OrderMonth", new DbFunctionCall("CAST({0} AS bigint)",
new object[] { new DbFunctionCall("MONTH", new object[] { CmsArticlesFields.DtCreationDate }) })) == i;
IPredicate yearFilter = new EntityField("OrderMonth", new DbFunctionCall("CAST({0} AS bigint)",
new object[] { new DbFunctionCall("YEAR", new object[] { CmsArticlesFields.DtCreationDate }) })) == year;
Filter.AddWithOr(monthFilter);
Filter.AddWithAnd(yearFilter);
}
}
art.GetMulti(Filter);
GridView1.DataSource = art;
GridView1.DataBind();
now problem is that i have to match year and month, but in above code i am also getting value of year 2009 also.
so how can i implement so i get only 2008 value???