Is there an easy way to sort a DataTable in a DataSet? I've tried a variety
of ideas, but none of them seems to work. I'm reading in the data from an
XML file and I want to sort the list of results, one of the "tables", by
date then send the DataSet off for further processing. Any suggestions
would be greatly appreciated.
TIA
Brad 3 1507
Get the DefaultView for the table and then set the Sort property. Something
like:
ds.Tables[0].DefaultView.Sort = "DateColumn ASC"
/claes
"Brad" <br************@roche.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Is there an easy way to sort a DataTable in a DataSet? I've tried a
variety of ideas, but none of them seems to work. I'm reading in the data
from an XML file and I want to sort the list of results, one of the
"tables", by date then send the DataSet off for further processing. Any
suggestions would be greatly appreciated.
TIA
Brad
Brad,
I don't believe the dataset or datatable has a way to physically re-arrange
rows to be in some sorted order, which sounds like what you want.
You can, of course, sort a view of the data, such as the defaultview of the
datatable. But the rows in the datatable will not be re-arranged.
Kerry Moorman
"Brad" wrote:
Is there an easy way to sort a DataTable in a DataSet? I've tried a variety
of ideas, but none of them seems to work. I'm reading in the data from an
XML file and I want to sort the list of results, one of the "tables", by
date then send the DataSet off for further processing. Any suggestions
would be greatly appreciated.
TIA
Brad
Brad,
As Cor pointed out in another newsgroup, the .Net 2.0 version of the
dataview has a ToTable method. You can use a dataview to sort the rows of a
datatable and then use ToTable to create a new data table with rows that will
be in sorted order.
Kerry Moorman
"Kerry Moorman" wrote:
Brad,
I don't believe the dataset or datatable has a way to physically re-arrange
rows to be in some sorted order, which sounds like what you want.
You can, of course, sort a view of the data, such as the defaultview of the
datatable. But the rows in the datatable will not be re-arranged.
Kerry Moorman
"Brad" wrote:
Is there an easy way to sort a DataTable in a DataSet? I've tried a variety
of ideas, but none of them seems to work. I'm reading in the data from an
XML file and I want to sort the list of results, one of the "tables", by
date then send the DataSet off for further processing. Any suggestions
would be greatly appreciated.
TIA
Brad This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nikki |
last post by:
Is it possible to sort a dataset rather than a dataview? I have a web
service that returns a dataset which I would like to sort before
returning it (this is so the sorting is standardised and so...
|
by: suzy |
last post by:
hello.
how can i sort data in a dataset? all the examples i have seen on msdn, etc
are sorting a dataview. this works fine, but i want to return the results
in xml and the dataview doesn't...
|
by: ddaniel |
last post by:
I have read many posts and seen many papers on the different
techniques for sort and filtering datagrids. Many do re-queries
against the dB ala Fritz Onion. I am trying to leverage the Dataview....
|
by: Richard |
last post by:
When i try sorting in the database, it sorts the numbers:
0
1
102
2
304
305
4
etc....
|
by: Nathan Franklin |
last post by:
Hello Guys,
I have been trying to work this our for so long, but I just can't seem to
find the answer.
I am loading a datatable from a an access database using an
oledbdataadapter. I then...
| |
by: Hushpappy |
last post by:
Hello,
I'm trying to sort a dataset,
for some reason, when i use the writeXml of the dataset obeject I don't
see any change.
i'm trying to put the view into a dataview and then sort it but...
|
by: Cindy Lee |
last post by:
I'm getting my data from an XML file. The data binds fine, but I can't sort
on it. Do I have to do anything special? I have enabled sorting on my grid
view. Autogenerate columns is off, and I...
|
by: =?Utf-8?B?R2VyaGFyZA==?= |
last post by:
I have a vb.net 2.0 app that is loading a GridView with a DataSource that is
returned from a function.
The definitions in the function are:
Dim ReportDS As DataSet = New DataSet
Dim...
|
by: rupalirane07 |
last post by:
Both grids displays fine. But the problem is only parent datagrid sorting works fine but when i clik on child datagrid for sorting it gives me error:
NullReferenceException error
Any...
|
by: mahesh123 |
last post by:
Hi,
I am using gridview in my form and binded the gridview with object datasource.I am trying to implement sorting for my grid view and i am getting following error.i am using asp.net with VB
...
|
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,...
| |
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |