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

LINQ filter by month and year

$
0
0

Hi, I am new to LINQ.

I managed to run some LINQ succesfully for CRUD.

Here is an extract of my code:

        var payroll = from pm in dc.Payroll_Masters
                      from pd in dc.Payroll_Details
                      //where pm.Salary_date
                      select pm;

        GridView1.DataSource = payroll;
        GridView1.DataBind();

Previously when my SQL is like

        sql = " Select * FROM Payroll_Master pm "
        sql += " INNER Join Payroll_Details pd On pm.id = pd.payroll_id "
        sql += " WHERE month(salary_date) = '3' "
        sql += " AND year(salary_date) = '2017' "

My questions is how do I do the same in LINQ?


Viewing all articles
Browse latest Browse all 1698

Trending Articles



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