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

as.net数据库查询的问题


 select *
   from Quote
   where name = 'xxx'
   or name = 'yyy'
   or name = 'zzz'
     order by name
   compute count(*) by name

在后台代码中执行了以上语句后就会根据分组统计出结果,我现在是想要获取统计值的数据,在代码中怎么写?
用DataSet可以么? --------------------编程问答-------------------- select count(*)
   from Quote
   where name in( 'xxx', 'yyy','zzz')
     order by name

ADO.NET ExectueScale
http://msdn.microsoft.com/zh-cn/library/system.data.sqlclient.sqlcommand.executescalar.aspx --------------------编程问答-------------------- compute count(*) by name
--------------------编程问答-------------------- select count(*) 数量
  from Quote
  where name in( 'xxx', 'yyy','zzz')
  order by name


DataSet ds= GrtDataSet();  //业务层方法

string result = ds.Tables[0].Rows[0]["数量"].ToString(); --------------------编程问答-------------------- 我要的是分组统计结果
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,