I am trying to do this
col1 col2 col3
a 1 b
a 2 c
a 3 d
changes to
col1 col2 col3
a 1 b, c, d
2
3
both col1 and col3 has text values
I wrote this code, what is wrong with this code? Anyone?
DataSet ds = new DataSet();
using (var mm = new OracleDataAdapter(objCmd))
mm.Fill(ds, "TableName");
objCmd.Dispose();
DataView dv = ds.Tables["TableName"].DefaultView;
DataTable dt = ds.Tables["SURVEY_MASTER"];
IEnumerable<string> query = (from row in dt.AsEnumerable()
select row.Field<string>("Col1")).Distinct();
this.GridView1.DataSource = query;
This code above is not working…….I am trying to change
either ds or datatable values and then to display it
in gridview
Whats wrong with the code?
Anyone have simple solution of what i am trying to achieve?
Please do write full code, if possible
by aggregating it that way you are violating column 2 because “c”,”d” are not “1”.
you should re-think your aggregation, or take out col2 from the equation.
this could be achieved using a group by
that way B,C,D will be in the single group.