Hi ahsan.ali,
Please take reference the below code and correct your code.
You can add multiple condition in the where condition.
Database
For this example I have used of NorthWind database that you can download using the link given below.
Download Northwind Database
HTML
<asp:GridView ID="gvEmployees" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" />
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="City" HeaderText="City" />
<asp:BoundField DataField="Country" HeaderText="Country" />
</Columns>
</asp:GridView>
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
int month = 10;
int year = 1993;
NorthwindEntities entity = new NorthwindEntities();
var result = entity.Employees
.Where(a => a.HireDate.Value.Month == month && a.HireDate.Value.Year == year)
.Select(x => new
{
x.EmployeeID,
x.FirstName,
x.City,
x.Country
});
this.gvEmployees.DataSource = result;
this.gvEmployees.DataBind();
}
}