如何计算C#窗体中的特定列值数据。 [英] How Do I Count Specific Column Value Data In C# Window Forms.

查看:68
本文介绍了如何计算C#窗体中的特定列值数据。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的朋友。我只想要一些例子............

1.m使用sql数据库...

2. supose列名是ABCD。

3.和ABCD柱值是



ABCD

nq

bs

as

bs

nq

abc

2

8

2

10









i想要特定数据如bs - 2

nq - 2

abc - 1

10 - 1

此类型

m使用查询



dt = new datatable()

com.text =来自dbtable的SELECT COUNT(ABCD)



for(int i = 0; i< dt.rows.count ;> {

textbox1.text = dt.rows [i] [ABCD]。ToString())



}



这种方法是对的,但问题是我想要一些上面的示例特定数据计数.............







请任何人帮助

谢谢你。

Respected frds. i want only some example............
1. m using sql database...
2. supose column name is ABCD.
3. and ABCD Column Value is

ABCD
nq
bs
as
bs
nq
abc
2
8
2
10
.
.


i want specific data count like bs - 2
nq - 2
abc - 1
10 - 1
this type
m using query

dt = new datatable()
com.text= "SELECT COUNT("ABCD") from dbtable"

for(int i=0; i<dt.rows.count;>{
textbox1.text= dt.rows[i]["ABCD"].ToString())

}

this method is right but problem is i want some upper example specific data count.............



please anybody help
thank u.

推荐答案

SELECT ABCD, Count(*) FROM dbtable GROUP BY ABCD



GROUP BY(Transact-SQL) [ ^ ]


这篇关于如何计算C#窗体中的特定列值数据。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆