sort a typed dataset table

G

Guest

Hi,

my application must iterate through a typed dataset table and I should set
a record-order before I itarate.

I gave a look at the dataview but it seems it cannot be typed...

Can you help me?
 
G

Guest

I also tried to set the dataset1.datatable1.defaultview.sort prop, but I
doesn't affect the datatable.

the iterating code is:
dataset11.datatable1.DefaultView.Sort = "RIFER_DISE" 'doesn't work
Dim rw As dataset1.datatable1
For Each rw In dataset11.datatable1.Rows
If rw.RowState <> DataRowState.Deleted Then
var1 = rw.CODICE_ART
var2 = rw.M_CONS
var3= rw.RIFER_DISE
....
End If
Next

I'm using vb.net 2005.
 
W

W.G. Ryan - MVP

Federico - the problem is that calling Sort on the view *doesn't* affect the
underlying table. So there is sorting going on, it's just happening to the
table's DefaultView and not to the table itself. Does this make sense?

If you want to iterate through the sorted data, you need to iterate the
view instead of the datatable.

For Each rw as DataRowView in dataset1.datatable1.DefaultView

Next

If you just want to work with the deleted rows, you ahve a few other
options, namely the RowStateFilter...
http://www.knowdotnet.com/articles/dataviews1.html
Let me konw if you have any problems.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top