473,786 Members | 2,608 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.S ort = "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 2867
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 programmaticall y, 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*********@gm ail.com> wrote in message
news:11******** *************@g 47g2000cwa.goog legroups.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.S ort = "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.S ort = "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.S ort = "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
2589
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 DataView. (I'm writing in C# with the v1.1.4322 of the .NET Framework, in Window2K server"). First of all, here are the two methods I have used in order to apply the sorting property to the DataView 1. Simply defining the sort order and colum DataView...
9
2101
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 DataView with 2 columns and 3 rows Dim ADOHelper As New DAL.ADOHelper Return ADOHelper.GetMyDataview() End
8
10417
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 together. To make data entry easier I would like to combine selected columns from the four tables onto a single dataview that could be used as the datasource for a datagrid control. The distinct updates, insert ans delete
1
3549
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 second column. When clicking on the first column, I want the GridView to sort on LastName and FirstName. Based on Microsoft's documentation of SortExpression property, all I have to do is to set SortExpression=LastName,FirstName on the first column....
0
1338
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 different columns so that users can sort the DataGrid by clicking the headers in the DataGrid. The DataGrid can be sorted using all the headers in the DataGrid except for the first column header. <asp:DataGrid ID="dg1" AllowSorting="true"...
1
21152
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 sort the table based on 1 column works perfectly fine. dvShiftData is a DataView
0
9650
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9497
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8992
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7515
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.