*DataSource has to be a DataSet it keeps telling me i cant implicitly convert type DataView to DataSet.. and i dont know how to convert it to
a dataset.. anyone who can help me???! thanx in advance..
a: What language are you using? DataSource* = sortView; is not legal in C#, unless you are in an unsafe block. b: "it keeps telling me i cant implicitly convert type DataView to DataSet". This is perfectly correct. But then - why are you sorting a DataView,
and not a DataSet? Your subject says you sort a DataSet, your code you sort a DataView - this does not match. As a DataView and a DatSet have nothing in common - conversions are not possible. c: and i dont know how to convert it to a dataset.. You can not.
A DataView is a view on a dataset. It is there in order to allow a grid to resort, without resorting the underlying dataset - only the view resorts in this case. Can you please specify exactly what you try to achieve (without code, but with more context -
what do you try to do, anyd why?), so that I can give yo ua better fitting answer?
ninjakongen
Member
70 Points
14 Posts
sorting a dataset
Aug 07, 2003 12:50 PM|LINK
if (currentRequest["action"] == "sort") { DataView sortView = new DataView(); DataView sortView = lowPrice.Tables["default"].DefaultView; sortView.Sort = (currentRequest["fieldname"]) + " " + (currentRequest["method"]); DataSource* = sortView; }*DataSource has to be a DataSet it keeps telling me i cant implicitly convert type DataView to DataSet.. and i dont know how to convert it to a dataset.. anyone who can help me???! thanx in advance..McMurdoStati...
Contributor
3015 Points
601 Posts
Re: sorting a dataset
Aug 07, 2003 03:38 PM|LINK
// C# if (currentRequest["action"] == "sort") { DataView sortView = new DataView(lowPrice.Tables["default"]); sortView.Sort = (currentRequest["fieldname"]) + " " + (currentRequest["method"]); DataSource = sortView; }autofed
Participant
1789 Points
357 Posts
Re: sorting a dataset
Aug 08, 2003 12:54 AM|LINK
ninjakongen
Member
70 Points
14 Posts
Re: sorting a dataset
Aug 11, 2003 07:34 AM|LINK
private DataSet _datasource; public DataSet DataSource { set { _datasource = value; } get { return _datasource; } }this is how the DataSource is declared..ninjakongen
Member
70 Points
14 Posts
Re: sorting a dataset
Aug 11, 2003 09:16 AM|LINK
public DataSet FilterSortData(DataSet _dataset, string filter, string sort) { DataSet sortDS = _dataset.Clone(); DataRow[] drs = _dataset.Tables[0].Select(filter, sort); foreach (DataRow dr in drs) { sortDS.Tables[0].ImportRow(dr); } return sortDS; }and then i call this function with the line.. anyways.. i wanna thank those of you who tried to help me.. Thanx!thona
Member
20 Points
2923 Posts
Re: sorting a dataset
Aug 11, 2003 09:39 AM|LINK