PC Review


Reply
Thread Tools Rate Thread

Applying custom sort order to typed dataset

 
 
Emma Burrows
Guest
Posts: n/a
 
      25th Jul 2006
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!


 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      25th Jul 2006
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]
- (E-Mail Removed)

"Emma Burrows" <ariana*@*NOSPAM*ntlworld.*com> wrote in message
news:uAB6a$(E-Mail Removed)...
>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!
>
>



 
Reply With Quote
 
Emma Burrows
Guest
Posts: n/a
 
      26th Jul 2006
"Nicholas Paldino [.NET/C# MVP]" <(E-Mail Removed)> wrote in
message news:eMiwF2$(E-Mail Removed)...
> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
In what order to call sever DataAdapters to update a typed dataset s.bussing@symax.nl Microsoft ADO .NET 1 8th Sep 2006 02:12 PM
sort a typed dataset table =?Utf-8?B?RmVkZXJpY28gQ2FzZWxsaQ==?= Microsoft ADO .NET 2 22nd May 2006 01:14 PM
Changing column order in typed dataset =?Utf-8?B?RGF2aWQgUg==?= Microsoft ADO .NET 7 7th Mar 2006 04:36 AM
typed dataset and sort order on save Donal McWeeney Microsoft ADO .NET 8 5th Jan 2005 04:15 PM
Applying Report's Sort Order via code TBernard Microsoft Access Reports 2 26th Mar 2004 06:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:53 PM.