按 C# 的顺序将行插入 Access Table
我有一个插入语句的排序列表,我正在尝试将其写入 Access 数据库。我已经三次验证插入语句列表的顺序是否正确。当我打开 mdb 文件时,记录永远不会按顺序排列。也许是前 100 条记录,但之后就开始变得不正常了。
我真的很茫然,有什么想法吗?请注意,此表首先是在 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许您只需要向表中添加一个 ID 字段,然后就应该维护插入顺序。
Maybe you just need to add an ID field to the tables and then the insertion order should be maintained.
当向任何数据库添加行时,“表内顺序”的概念是没有意义的。
您可以在使用 ORDER BY 检索记录时获得订单。
确保您有要排序的 ID 或时间戳列。
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.