当前位置:编程学习 > C#/ASP.NET >>

如何LINQ查询某表记录数?

假设有表A,现在想使用LINQ查询该表的全记录数赋值给count的int型变量,这个语句怎么写呢?谢谢~ --------------------编程问答-------------------- var Query = from a in A
            select a;

int count=Query.Count(); --------------------编程问答-------------------- int count1 = (from a in A select a).Count()
int count2 = db.A.Count(); --------------------编程问答-------------------- 一直想知道linq如何使用,学习一下 --------------------编程问答-------------------- int count = from a in A 
            select a.Count(); 
--------------------编程问答-------------------- var db=new 数据描述类名();
var q=db.表名.Count();

var q=(from r in db.表名
       selcet r).Count();
--------------------编程问答-------------------- DataContent dataContent = new DataContent();
dataCountent.Table.Count(); --------------------编程问答-------------------- 怎么有那么多的垃圾的回复,误导别人 --------------------编程问答--------------------
引用 7 楼  的回复:
怎么有那么多的垃圾的回复,误导别人

你厉害你说个看看 --------------------编程问答-------------------- var countNo=(from tab in db.表名
  selcet tab).Count(); --------------------编程问答-------------------- var result=数据库.表.count();
这就是linq的映射 

那个数据库不是直接写的   要添加数据模型

回答的那有不对的地方尽管提出,多多吸取大家的指导
补充:.NET技术 ,  LINQ
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,