年份为当前年份的行数

Count of rows where the year is the current one

我正在尝试 运行 在 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

无法识别该函数

我该怎么做?谢谢

试试这个:

SELECT COUNT(*)
from objetos 
where DATEPART(year, datarececao) = DATEPART(year, GETDATE())