我试图在SQL Server Compact中运行此查询
SqlCeCommand saldo = new SqlCeCommand("select count(*) from objetos where year(datarececao) = getdate()", con);
Int32 count5 = (Int32)saldo.ExecuteScalar();
label16.Text = Convert.ToString(count5);
但是因为这是一个SQL / MySQL查询,我得到一个错误,SQLCE无法识别该函数
我该怎么做?感谢
答案 0 :(得分:2)
试试这个:
SELECT COUNT(*)
from objetos
where DATEPART(year, datarececao) = DATEPART(year, GETDATE())