Here i have sample code, in which i was using MS SQL Server
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;
but now i am using MY SQL, so it throw error like this :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bigint) = 1 AND CAST(YEAR(cms_articles
.dtCreationDate
) AS bigint) = 2009))) ' at line 1
Total = Convert.ToInt32(art.GetDbCount(dateFilter));
My Full Code Like this :
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;
PredicateExpression dateFilter = new PredicateExpression();
dateFilter.Add(monthFilter);
dateFilter.Add(yearFilter);
Total = Convert.ToInt32(art.GetDbCount(dateFilter));
is DB Function is different than MS SQL ??
please help me to solve this problem