Click here to Skip to main content
15,347,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to count the records which are in sql server database using linq in

Hmmm, I dont think you Googled this!!!

MyDatabaseEntities context = new MyDatabaseEntites();
int recordCount = context.MyEntityObject.Count();
try this:

Int count = (From cust in db.Customers Select cust.CompanyName).Count();

hope it helps :)
var abc = (from p in db.Clients
select p.ID).Count();
Label1.Text = abc.ToString();
using Linq and Lambda Expression
items1.Select(p => p).Count();
Int count = (From employee in db.employeedetails Select employee.CompanyName).Count();

hope this help you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900