![]() |
Click here to advertise with us
|
|
|||||||
| ADO.NET Anything regarding DataAdapters, DataReaders, DataSets, etc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi everyone!
I have a problem with sorting a DataTable. I'm using DataView.Sort and then DataView.ToTable() to get the sorted table. Then I go through the table row by row and create nodes in a TreeView which is shown in a desktop application. My problem is that I can sort the data in ascending order and it is shown in the TreeView in a correct way, but when I use the same sort mechanism but just change the order to descending it doesn't work. But maybe the problem lies in the DataView.ToTable function. Does this keep a descending order or do I have to fix this myself when I create nodes in my TreeView by going through the DataRows in reverse order? Hoping someone knows this. Thanks in advance, /Ylva |
|
||||
|
My test show both sort orders are preserved.
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
Ok. Then something must be really strange about my code because when I step through my sorting function I see that the sort direction is "DESC" and then I run the ToTable() function but when I step through the resulting table like this..
Code:
For r As Integer = 0 To dataTable.Rows.Count - 1
Dim row As DataRow = dataTable.Rows(r)
......
Next
What could be the explanation for this? |
![]() |
| Bookmarks |
| Tags |
| dataview, desc, sort, totable |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|