Calculo edad sql:
datepart(YYYY,getdate()) - datepart(YYYY,u.
-case when datepart(dy, getdate()) < datepart(dy, u.FechaNacimiento) then 1
else 0
end
as Edad
Calculo edad c#:
int intAge = DateTime.Today.Year - lCandidate.BirthDate.Year;
if (DateTime.DaysInMonth(DateTime.Today.Year, lCandidate.BirthDate.Month) >= lCandidate.BirthDate.Day && new DateTime(DateTime.Today.Year, lCandidate.BirthDate.Month, lCandidate.BirthDate.Day) > DateTime.Today)
intAge--;
else if (DateTime.DaysInMonth(DateTime.Today.Year, lCandidate.BirthDate.Month) < lCandidate.BirthDate.Day && new DateTime(DateTime.Today.Year, lCandidate.BirthDate.Month, DateTime.DaysInMonth(DateTime.Today.Year, lCandidate.BirthDate.Month)) > DateTime.Today)
{
intAge--;
}
