devxlogo

Can’t use the “Between” Keyword in a LINQ Query

Can’t use the “Between” Keyword in a LINQ Query

You can’t use the “Between” keyword in a LINQ query.

The sample snippet below shows how you translate between two date fields.

DateTime fromDate = DateTime.Now.AddMonths(-3); DateTime endDate = DateTime.Now; //linq query var result = from te in datatable.AsEnumerable()                         where (te.Field("Month") = fromDate)                         && (te.Field("Month")

devx-admin

Share the Post: