将结果分组到asp.net gridview中 [英] Grouping result into asp.net gridview
问题描述
我有一张StudentResult表..
其中字段ID:
StudentID SubjectCode标记。
1001 BB101 80
1001 BB102 90
1001 BB103 70
1002 BB101 70
1002 BB102 70 >
1002 BB103 60
我想在asp中显示Total Grouping结果。 net gridview:
StudentID总分数
1001 240
1002 200
SELECT StudentId,SUM(Marks) As TotalMarks
FROM 表名
组 按 StudentId
试试这个,看看。
选择StudentID,sum(Marks)作为来自tablename组的Total Marks by StudentID
使用此查询并将结果绑定到这样的网格视图
gridview.datasource = ds.tables [0];(您使用的数据表或数据集)
gridview.databind();
如果有帮助请选择答案....
此链接 [ ^ ]应该可以帮到你进行。
I have a StudentResult Table..
where field id :
StudentID SubjectCode Marks.
1001 BB101 80
1001 BB102 90
1001 BB103 70
1002 BB101 70
1002 BB102 70
1002 BB103 60
I want to display Total Grouping result into asp.net gridview :
StudentID Total Marks
1001 240
1002 200
SELECT StudentId,SUM(Marks) As TotalMarks FROM Tablename Group By StudentId
Try this and see.
select StudentID,sum (Marks) as Total Marks from tablename group by StudentID
use this Query and Bind the result to the Grid View like this
gridview.datasource=ds.tables[0];(datatable or dataset which u used)
gridview.databind();
please select as answer if it helps....
This link[^] should help you out.
这篇关于将结果分组到asp.net gridview中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!