I think you can pass a DataView to setdatasource(). I've not tested it
myself but see this post:
http://forums.microsoft.com/MSDN/Sho...70964&SiteID=1
I know there used to be a bug with SetDataSource() and you had to sort the
data in a DataView then copy it back into a clone of the original DataTable.
I think this has long been fixed though. The workaround went something like
this:
System.Data.DataTable origTbl; // Your original table
DataView dv;
System.Data.DataTable sortedTbl;
dv = origTbl.DefaultView;
dv.Sort = "col1 asc, col2 asc";
// Copy the sorted view into a new table..
sortedTbl = dv.Table.Clone();
for (int i = 0; i < dv.Count; i++)
{
sortedTbl.ImportRow(dv[i].Row);
}
Hope this helps,
Jason Vermillion
"Pucca" wrote:
Quote:
I want to pass a sorted dataset table to Crystal Report becuase I think it
might give better performance. I don't think that dataview can be passed as
a datasource to crystal and the sorted result isn't saved to the dataset
table either, right?
--
Thanks.
>
>
"Jason Vermillion" wrote:
>
Quote:
Pucca,
You can do it a couple of different ways. You'll find a lot of good
examples from a Google for DataTable.Select or DataView.Sort.
Most folks use System.Data.DataView.Sort since the results are a bit easier
to deal with than the array that DataTable.Select() returns.
see this article:
http://www.akadia.com/services/dotnet_filter_sort.html
Jason Vermilllion
"Pucca" wrote:
Quote:
Are there any good built-in or availble functions that I can call to sort my
dataset datatalbe based on 1 or more of the table's columns?
--
Thanks.