ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Select record having age between 18 and 21 using Linq query in Entity Framework<p>&nbsp;</p> <pre class="brush: csharp">var year = DateTime.Now.Year; var month = DateTime.Now.Month; var day = DateTime.Now.Day; string dob1= dobyear1 + &#34;-&#34; + month + &#34;-&#34; + day; DateTime dob21 = Convert.ToDateTime(dob1); var dobyear2 = year - 25; string dob2 = dobyear2 + &#34;-&#34; + month + &#34;-&#34; + 1; DateTime dob22 = Convert.ToDateTime(dob2); var userslist = db.Users.Where(s =&gt; s.Gender == &#34;Female&#34; &amp;&amp; s.DOB &lt;= dob21 &amp;&amp; s.DOB &gt;= dob22).ToList();</pre> <p>It's working&nbsp;</p>https://www.aspforums.net:443/Threads/491040/Select-record-having-age-between-18-and-21-using-Linq-query-in-Entity-Framework/https://www.aspforums.net:443/Threads/491040/Select-record-having-age-between-18-and-21-using-Linq-query-in-Entity-Framework/Tue, 07 Aug 2018 01:00:39 GMT