如何在SQL Server的帮助下将行提取到gridview的列中. [英] How to fetch rows into column in gridview with the help of sql server.
本文介绍了如何在SQL Server的帮助下将行提取到gridview的列中.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Id Date Attendance
LAB01 2012-06-01 P
FBD/SL/01/2012 2012-06-01 A
FBD/SL/05/2012 2012-05-01 P
LABOCP/121 2012-06-01 P
LABOCP/123 2012-06-01 P
LAB01 2012-06-02 P
FBD/SL/01/2012 2012-06-02 A
FBD/SL/05/2012 2012-05-02 P
LABOCP/121 2012-06-02 P
LABOCP/123 2012-06-02 P
LAB01 2012-06-03 P
FBD/SL/01/2012 2012-06-03 A
FBD/SL/05/2012 2012-05-03 P
LABOCP/121 2012-06-03 P
LABOCP/123 2012-06-03 P
LAB01 2012-06-05 P
FBD/SL/01/2012 2012-06-05 A
FBD/SL/05/2012 2012-05-05 P
LABOCP/121 2012-06-05 P
LABOCP/123 2012-06-05 P
我想将行翻转为列,以便此表在Gridview中看起来像这样.
I would like to flip the rows to be columns so that this table looks like this in Gridview.
Id 2012-06-01 2012-06-02 2012-05-03 2012-06-04 2012-06-05 TP
LAB01 P P P - P 4
FBD/SL/01/2012 A P P - P 3
FBD/SL/05/2012 P A P - P 3
LABOCP/121 P P A - P 3
LABOCP/123 P P P - A 3
推荐答案
您必须尝试: ^ ]
看看更多示例:
SQL中的数据透视表服务器.一个简单的示例. [ http://msdn.microsoft.com /en-us/library/ms177410(v=sql.105).aspx [
You must try: Pivot Table[^]
Have a look for more examples:
Pivot tables in SQL Server. A simple sample.[^]
Here are more detailed description of PIVOT: http://msdn.microsoft.com/en-us/library/ms177410(v=sql.105).aspx[^]
请参阅以下链接,希望对您有所帮助:
http://www.c-sharpcorner .com/UploadFile/1a81c5/display-columns-as-rows-in-gridview-in-Asp-Net/ [ http://aspalliance.com/538_CodeSnip_Pivot_Tables_with_ADONET_and_Display_in_a_DataGrid_Paged_Horizontally.all [ ^ ]
http://www.dotnetspider.com/forum/138106-I-want-display-rows-columns-columns-rows-gridview.aspx [
See below links, hope they help you:
http://www.c-sharpcorner.com/UploadFile/1a81c5/display-columns-as-rows-in-gridview-in-Asp-Net/[^]
http://aspalliance.com/538_CodeSnip_Pivot_Tables_with_ADONET_and_Display_in_a_DataGrid_Paged_Horizontally.all[^]
http://www.dotnetspider.com/forum/138106-I-want-display-rows-columns-columns-rows-gridview.aspx[^]
这篇关于如何在SQL Server的帮助下将行提取到gridview的列中.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文