Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > datatable sort

Reply
Thread Tools

datatable sort

 
 
reiks
Guest
Posts: n/a
 
      12-08-2003
I have a datatable . My requirement is to sort the table
rows in ascending and descending order basing on the
columns which I give it.

I've used the following expression

ds.Tables[0].DefaultView.Sort="au_fname";

but it's sorting in ascending order but not in descending.

How to specify the descending order.

also let me know how can I include multiple columns in my
above expression
 
Reply With Quote
 
 
 
 
Bin Song
Guest
Posts: n/a
 
      12-08-2003
A string containing the column name followed by "ASC"
(ascending) or "DESC" (descending). Columns are sorted
asending by default. Multiple columns can be separated by
commas.
ds.Tables[0].DefaultView.Sort="au_fname DESC";

Bin Song, MCP

>-----Original Message-----
>I have a datatable . My requirement is to sort the table
>rows in ascending and descending order basing on the
>columns which I give it.
>
>I've used the following expression
>
>ds.Tables[0].DefaultView.Sort="au_fname";
>
>but it's sorting in ascending order but not in descending.
>
>How to specify the descending order.
>
>also let me know how can I include multiple columns in my
>above expression
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Sort a datatable and create a new datatable Fredrik Rodin ASP .Net 3 09-28-2007 07:28 AM
Create a Datatable from a SQL datatable column shema? jg ASP .Net 1 08-17-2004 09:43 PM
Casting DataTable to class inherit from DataTable =?Utf-8?B?Qmx1ZWZsb3dlcg==?= ASP .Net 0 04-02-2004 05:41 AM
Ado sort error-Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB. Navin ASP General 1 09-09-2003 07:16 AM
Adding DataTable Rows To another DataTable J. Babe ASP .Net 1 08-15-2003 05:04 PM



Advertisments