By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,701 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,701 IT Pros & Developers. It's quick & easy.

Applying custom sort order to typed dataset

P: n/a
I have created a typed dataset in .Net 2.0 based on an Access database, and
set up various methods to retrieve specific data from the tables, etc (great
fun). However, I need to implement a custom sort order on a text column. I
know how to implement this in an IComparer and apply it to a custom
collection or an array, but I don't see an easy way to tie this up with my
strongly typed dataset (short of adding the extra step of feeding it into a
custom collection or an array...).

I would welcome any existing code examples of how to do this, or at least
suggestions that might point me in the right direction. Thanks!
Jul 25 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Emma,

Why not use a DataView on the typed DataTable? In the end, it is a
DataTable, and a DataView is meant to provide this kind of "view" on the
data.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Emma Burrows" <ariana*@*NOSPAM*ntlworld.*comwrote in message
news:uA**************@TK2MSFTNGP02.phx.gbl...
>I have created a typed dataset in .Net 2.0 based on an Access database, and
set up various methods to retrieve specific data from the tables, etc
(great
fun). However, I need to implement a custom sort order on a text column. I
know how to implement this in an IComparer and apply it to a custom
collection or an array, but I don't see an easy way to tie this up with my
strongly typed dataset (short of adding the extra step of feeding it into
a
custom collection or an array...).

I would welcome any existing code examples of how to do this, or at least
suggestions that might point me in the right direction. Thanks!


Jul 25 '06 #2

P: n/a
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:eM**************@TK2MSFTNGP04.phx.gbl...
Why not use a DataView on the typed DataTable?
Thanks for the suggestion. I did have a look into DataView, but it only
seems to allow you to apply a sort order based on a basic SQL statement (eg:
"Title, Author DESC"). My problem is that I need the rows to be sorted on
far more complex criteria than that.

To be specific, I'm sorting book titles by their first significant word; on
the current version of my website, I use XSL to do this (see
http://www.codeproject.com/soap/XSLSorting.asp for details of the sort order
I'm trying to achieve and how I did this in XSL). I'm converting the website
to use .Net features but this is one thing I haven't managed to work out yet
(except using an IComparable object, but I don't see how to apply that to my
DataSet). So suggestions are still welcome. :)
Jul 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.