数据集以组格式呈现 [英] dataset render in group format
本文介绍了数据集以组格式呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是数据集表
ds.table [1]
This is dataset table
ds.table[1]
country total yr
UK 1000 2011
UK 2000 2011
UK 3000 2011
India 3000 2011
India 1000 2011
US 5000 2011
US 5000 2011
我想像下面的组结构一样显示上面的数据集
i want to display above dataset like below group structure
country total yr
uk ---- ---
UK 1000 2011
UK 2000 2011
UK 3000 2011
India --- ----
India 3000 2011
India 1000 2011
US --- ----
US 5000 2011
US 5000 2011
推荐答案
尝试类似的方法...
DataSet dsTemp = GetDataSet();
DataTable dtTemp = dsTemp.Tables [0];
///SQL代码可能类似于按国家/地区分组"
DataRow []行= dtTemp.Select("*** SQL CODE HERE ***");
DataTable dtNew =新的DataTable();
foreach(行中的DataRow dr)
{
dtNew.ImportRow(dr);
}
DataSet dsNew =新的DataSet();
dsNew.Tables.Add(dtNew);
Try something like this...
DataSet dsTemp = GetDataSet();
DataTable dtTemp = dsTemp.Tables[0];
/// SQL Code could be something like ''GROUP BY country''
DataRow[] rows = dtTemp.Select("***SQL CODE HERE***");
DataTable dtNew = new DataTable();
foreach (DataRow dr in rows)
{
dtNew.ImportRow(dr);
}
DataSet dsNew = new DataSet();
dsNew.Tables.Add(dtNew);
这篇关于数据集以组格式呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文