统计每个分类的人数
2019-04-01 本文已影响0人
czm123
//直接按钮搜索
private void button5_Click(object sender, EventArgs e)
{
string s = "select department.deptno as 系号,department.deptname as 系名,";
s += "sum(class.num) as 人数 ";
s += "from class,department where class.deptno=department.deptno ";
s += "group by department.deptno,department.deptname";
loadLV(listView2, s);
}
//列表选择种类
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
string s = "select year as 年份,sum(num) as 学生人数 from class ";
s += "where year =" + comboBox2.Text;
s += " group by year";
loadLV(listView2, s);
}