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.