Sorting dataset

Wirloff

Member
Joined
Mar 2, 2005
Messages
19
Location
Belgium
Programming Experience
1-3
Hi,
before I write my dataset to the database, I would like to sort it on a certain column. I've found some examples on the Internet, but they all used a 'dataview' to sort a DATAGRID. => but I'm not using a datagrid:S..

What would be te easiest way to sort a dataset? Can I use a dataview on my dataset to sort it, and if I sort the data in the dataview, how will the changes be copied into the dataset??

Niko
 
Not sure why you need to do it...

What would be the advantage of sorting before you save. Hopefully, your dataset is structured with key values that create indexes that do the sorting for you. If you need the dataset sorted in a particular way you can accomplish it with the SQL select - ORDER BY [Part ID] or ORDER BY [Part ID] DESC clause at the time you load it.

Dim DV As DataView
DV = New DataView(DsPart1.Tables("part"))
DV.Sort = ("Part ID")

This dataview is linked to a table, but it does not effect the way it is saved, just displayed.
 
Back
Top