By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,333 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,333 IT Pros & Developers. It's quick & easy.

New rows not sorted in DataSet

P: n/a
I have a Customer table with a PK Autonumber (CustomerID) in my DataSet
with 20 records to begin with. I can add a new record to the database
using the following code:

Dim drCustomer As DataRow = dsTurbobraze.Customer.NewRow
drCustomer.Item("CustomerForename") = "John"
drCustomer.Item("CustomerSurname") = "Smith"
drCustomer.Item("CustomerPostcode") = "E1 1EE"
dsTurbobraze.Customer.Rows.Add(drCustomer)

It shows up fine in my Access database (VB automatically creates
CustomerID autonumber) but in the DataSet it always shows up in this
order: 21, 22, 23 ....1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16 17, 18, 19, 20

The newrows always get added to the beginning of the DataSet, how do I
get them at the end so they show up in the right order in the DataSet?
Is it possible to re-sort the Dataset index according to a specific
field (CustomerID)? I tried using this but no luck:

dsTurbobraze.Customer.Rows.InsertAt(drCustomer,
dsTurbobraze.Customer.Rows.Count)

I've read some previous threads and they all mention using DataView,
but they don't elaborate much. Some sample code would be appreciated.

Mar 24 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.