开发者

Insert rows into Access Table in order from c#

开发者 https://www.devze.com 2023-02-25 09:58 出处:网络
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 rec

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开发者_Python百科 C# first dynamically - i.e. the set of of columns is not predictable each time this code needs to be run.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号