Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Please I need help with this EF CORE Query

$
0
0

Dear All,

I am trying to read customers who have their birthdays today.

var customers = await this.context.Customers.Where(item=>item.DOB != null && ((DateTime)(item.DOB.Value)).Day == currentdate.Day && ((DateTime)(item.DOB.Value)).Month == currentdate.Month).ToListAsync();

Unfortunately it is not working.

 public class Customer
    {
        public int CustomerID { get; set; }

        [Column(TypeName = "Date")]
        public DateTime? DOB { get; set; } // Meaning date of Birth of the user

}

I dont know what the problem is.


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>