Click here to Skip to main content
15,906,301 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

1 solution

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);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900