G
Guest
Hello,
Can anyone tell me what is wrong with the following? I am
trying to sort a table, then return it as the dataset.
The dataset ds1 is returned, but is the same as the
orignal, meaning that the sort did not take place.
Thanks,
David
(existing dataset ds passed in to method)
....
DataView dv = ds.Tables[0].DefaultView;
dv.ApplyDefaultSort = false;
dv.Sort = "EVENT_DATE, LOCATION_CODE desc";
DataTable dt = dv.Table.Copy();
DataSet ds1 = new DataSet(dv.Table.TableName);
ds1.Tables.Add(dt);
return ds1
Can anyone tell me what is wrong with the following? I am
trying to sort a table, then return it as the dataset.
The dataset ds1 is returned, but is the same as the
orignal, meaning that the sort did not take place.
Thanks,
David
(existing dataset ds passed in to method)
....
DataView dv = ds.Tables[0].DefaultView;
dv.ApplyDefaultSort = false;
dv.Sort = "EVENT_DATE, LOCATION_CODE desc";
DataTable dt = dv.Table.Copy();
DataSet ds1 = new DataSet(dv.Table.TableName);
ds1.Tables.Add(dt);
return ds1