在vb.net中按降序准备列

时间:2013-07-07 17:20:10

标签: vb.net sql-server-2005

                  EthylAcetate      PrintCylinder   HDpolythene
                       12                8               5
                        9                2               9

我想分别在每列中添加值,并根据总数按照降序排列datagrid中的列..上面我提到了我使用的代码。

它确实给了我每行的总和,但它并没有给我排序的列。

cmd.CommandText = "SELECT sum(eAce) as SumEacetate , sum(pCl) as PrintCylinder  , sum(hdp) as HDpolythene FROM TblSalesOrder ORDER BY SumEacetate, PrintCylinder  , HDpolythene DESC ;"

1 个答案:

答案 0 :(得分:0)

您必须为每列编写DESC个关键字

cmd.CommandText = "SELECT sum(eAce) as SumEacetate , sum(pCl) as PrintCylinder  , sum(hdp) as HDpolythene FROM TblSalesOrder ORDER BY SumEacetate DESC, PrintCylinder DESC, HDpolythene DESC ;"