young_nacs
asked on
sort DataSet with multiple column names
Hi I have one data table and I have usercontrol to return dataset of data table.
Because I have multiple columns in the data table , I like to sort by
"column1(String), column2(String), column3(DateTime) DESC" , and then return dataset.
Here is my code.
//create disk data table already, diskDT
//ds.Tables.Add(diskDT); //assign to dataset as a return later
string sortstr = "PatientID,ShotDate,ShotPr oc,FileNam e DESC";
DataView dv = new DataView();
dv = diskDT.DefaultView;
dv.Sort = sortstr;
ds = dv.Table.DataSet;
return ds
However, data set shows the original and did not sort it out.
How can I get the sort result to dataset?
Because I have multiple columns in the data table , I like to sort by
"column1(String), column2(String), column3(DateTime) DESC" , and then return dataset.
Here is my code.
//create disk data table already, diskDT
//ds.Tables.Add(diskDT); //assign to dataset as a return later
string sortstr = "PatientID,ShotDate,ShotPr
DataView dv = new DataView();
dv = diskDT.DefaultView;
dv.Sort = sortstr;
ds = dv.Table.DataSet;
return ds
However, data set shows the original and did not sort it out.
How can I get the sort result to dataset?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
its return ds and not diskDT.