Hi Rezu2215,
Refer below sample.
Database
For this sample I have used of NorthWind database that you can download using the link given below.
Download Northwind Database
HTML
<asp:Label id="lblCount" runat="server" />
<br />
<asp:Label id="lblCountryCountUSA" runat="server" />
<br />
<asp:Label id="lblCountryCountUK" runat="server" />
Namespaces
C#
using NorthwindModel;
VB.Net
Imports NorthwindModel
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
NorthwindEntities entity = new NorthwindEntities();
var result = (from emp in entity.Employees
select emp);
var countryCountUSA = (from emp in entity.Employees
select emp).Where(x => x.Country == "USA");
var countryCountUK = (from emp in entity.Employees
select emp).Where(x => x.Country == "UK");
lblCount.Text = "Total Number of Records : " + result.Count().ToString();
lblCountryCountUSA.Text = "USA Record Count is : " + countryCountUSA.Count().ToString();
lblCountryCountUK.Text = "UK Record Count is :" + countryCountUK.Count().ToString();
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim entity As NorthwindEntities = New NorthwindEntities()
Dim result = (From emp In entity.Employees Select emp)
Dim countryCountUSA = (From emp In entity.Employees Select emp).Where(Function(x) x.Country = "USA")
Dim countryCountUK = (From emp In entity.Employees Select emp).Where(Function(x) x.Country = "UK")
lblCount.Text = "Total Number of Records : " & result.Count().ToString()
lblCountryCountUSA.Text = "USA Record Count is : " & countryCountUSA.Count().ToString()
lblCountryCountUK.Text = "UK Record Count is :" & countryCountUK.Count().ToString()
End Sub
Output
Total Number of Records : 9
USA Record Count is : 5
UK Record Count is :4