Solved

how to access DataTable rows, as ordered by DefaultView?

Posted on 2006-11-13
4
246 Views
Last Modified: 2006-11-18
I am not able to influence the construction of a certain DataTable.  To display it's contents, I set an "order by" clause into table1.DefaultView.Sort.  Everything is good in the gui (asp.net DataGrid), but I am having trouble accessing the records programmatically in that same sorted order.

Is there a way to actually sort the records in the DataTable?

Thanks for any help-
VS 2003
0
Comment
Question by:ottenm
  • 3
4 Comments
 
LVL 18

Accepted Solution

by:
Elvio Lujan earned 250 total points
ID: 17932542
no the DefaultView is just a view!... to get the records ordered in the table you need to order in the source
0
 

Author Comment

by:ottenm
ID: 17932756
Then how to access the data using the view (so they come out sorted)?
0
 

Author Comment

by:ottenm
ID: 17932853

Found it, could also use for each:

        Dim v As DataView = table1.DefaultView
        While i < v.Count - 1
            Dim row As DataRowView = v.Item(i)
            Dim val As String = row("ColumnName")
            'etc.
        End While

0
 

Author Comment

by:ottenm
ID: 17932865
What's the right thing to do if you answer your own question?
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question