Click here to Skip to main content
15,922,309 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 asp.net
Posted

Hmmm, I dont think you Googled this!!!

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

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


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


hope this help you
 
Share this answer
 
v2

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