473,399 Members | 3,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Multiple directions in DataView.Sort

Hi everyone.

If I have a table T with columns C1 and C2, I would like to know if the
following is possible:

T.DefaultView.Sort = "C1 ASC, C2 DESC";

If this is not so, I would really appreciate other options you might
think of.
Table T is not populated from a database. It is created and filled
dynamically, so receiving the data pre-sorted is not an option.

Thanks in advance.

Jehu.

Nov 17 '05 #1
2 2852
Jehu,

All you have to do is look up DataView.Sort in the help and you'll find this
about what goes in the Sort property:

"A string containing the column name followed by "ASC" (ascending) or "DESC"
(descending). Columns are sorted ascending by default. Multiple columns can
be separated by commas."
You could have tested to see if this worked in about 3 minutes, too.

The source of the data (whether it comes from a back end database or is
inserted into the DataTable programmatically, etc) has no bearing on whether
or not this works, if that's what you're wondering. You can think of a
DataSet as a lightweight client-side in-memory database, really.

--Bob

"alAzif" <da*********@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
Hi everyone.

If I have a table T with columns C1 and C2, I would like to know if the
following is possible:

T.DefaultView.Sort = "C1 ASC, C2 DESC";

If this is not so, I would really appreciate other options you might
think of.
Table T is not populated from a database. It is created and filled
dynamically, so receiving the data pre-sorted is not an option.

Thanks in advance.

Jehu.

Nov 17 '05 #2
Thanx for replying.

I have, in fact, tested it.
Using my previous example:

T.DefaultView.Sort = "C1 ASC, C2 DESC";

I found it only respects the direction given to C1 (ASC), the other one
is completely ignored when browsing the results.

I have looked at several sources on the internet, some say you can give
multiple directions in the Sort expression and others, like MSDN, only
provide examples where a single direction is used, and is specified at
the end of the expression:

T.DefaultView.Sort = "C1, C2 DESC";

Have you tried using multiple directions in the DataView.Sort property?

Thanks in advance.
Jehu.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: jwedel_stolo | last post by:
Hi I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of the...
9
by: Raymond Lewallen | last post by:
I have a dataview in which the sort property will not sort the dataview. Here's is a simple scenario similar to what I am doing: Class Foo Private Function Retrieve() As DataView ' Returns a...
8
by: Jason L James | last post by:
Hi all, does anyone know if I can create a dataview from multiple datatables. My dataset is constructed from four separate tables and then the relationships are added that link the tables...
1
by: Eric | last post by:
I have a GridView control that I want to sort on multiple columns when I click a particular column. For example, I display Last name + ", " + First name in the first column and display id in the...
0
by: rn5a | last post by:
A DataGrid control displays records from a SQL Server 2005 DB table. The AllowSorting property of the DataGrid has been set to True & the SortExpressions of the BoundColumns have been set to the...
1
by: Hetal | last post by:
Hi... We are on Visual Basic .NET 2003 and i am using DataView to sort the DataTable. However, we are facing problems with sorting the data based on multiple columns. The below statement to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.