linq相关问题 [英] linq related question
本文介绍了linq相关问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用asp.net中的linq来计数sql服务器数据库中的记录.
how to count the records which are in sql server database using linq in asp.net
推荐答案
嗯,我不认为您用Google搜索了这个!!! />
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 =(来自db.Clients中的p
选择p.ID).Count();
Label1.Text = abc.ToString();
var abc = (from p in db.Clients
select p.ID).Count();
Label1.Text = abc.ToString();
这篇关于linq相关问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文