AJPennyPacker
AJPennyPacker

Reputation: 31

Insert rows into Access Table in order from c#

I have a sorted list of insert statements that I am trying to write to an Access db. I have triple verified that the list of insert statements is in the correct order. When I open the mdb file the records are never in order. Maybe for the first 100 records, but after that it starts getting out of whack.

I am really at a loss here, any ideas? Note that this table is being created in C# first dynamically - i.e. the set of of columns is not predictable each time this code needs to be run.

Upvotes: 2

Views: 842

Answers (2)

Henk Holterman
Henk Holterman

Reputation: 273504

When adding rows to any database, the concept of "Order inside a Table" is meaningless.

You get your order when retrieving records by using an ORDER BY.

Make sure you have an ID or TimeStamp column to sort on.

Upvotes: 1

Nik
Nik

Reputation: 7273

Maybe you just need to add an ID field to the tables and then the insertion order should be maintained.

Upvotes: 1

Related Questions