在C#中对值进行分组

时间:2013-09-02 19:07:33

标签: c# asp.net group-by grouping

我必须根据状态将所有itens分组到Datatable中,我只拥有包含所有数据量的DataTable。

DataTable results;
using (var sqlDataAccess = new MSQLDataAccess(Util.GetIntegraConnectionString))
{
    results = sqlDataAccess.GetDataTable(query, parameters);
}

结果变量包含以下数据:

DBSMP.DTINICIOPREV
DBSMP.DTFIMPREV
DBSMP.CIDADE_DES 
DBSMP.CIDADE_ORI
DBSMP.REF2
WORK.DESCRIPTION <<-- Group here
TRA.FANTASIA

我必须按WORK.DESCRIPTION进行分组,并提供以下数据:



HOUSES = 3

DTINICIOPREV | DTFIMPREV |CIDADE_DES | CIDADE_ORI | REF2 | FANTASIA 
DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE  
DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE  
DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE  

FLATS = 5

DTINICIOPREV | DTFIMPREV |CIDADE_DES | CIDADE_ORI | REF2 | FANTASIA 
DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE  
DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE  
DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE 
DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE  
DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE DATA HERE 

那么将results转换为多个分组数据列表的最佳方法是什么?

0 个答案:

没有答案