SQL Server CE 3.5 的不正确重复插入问题
我无法再将数据插入我的表中!
这是我的桌子设计。
intId 是主键,没有明确定义其唯一约束,身份增量设置为 1 并且身份种子为 1。
我通过 LINQ 将数据插入到该表中。
testDB.tbl_Vehicle.InsertOnSubmit(newVehicle);
testDB.SubmitChanges();
这一切以前都有效,现在突然就失效了!
现在显示
A duplicate value cannot be inserted into a unique index. [ Table name = tbl_Vehicle,Constraint name = PK_tbl_Vehicle ]
更多信息:此桌面应用程序有 1 个可执行文件和 1 个 .sdf 文件。它是在Win 7上开发的,最近被转移到Win XP系统上。但这不应该成为问题,因为我正在插入具有类似逻辑和表设计的其他表。
I am not able to insert data into my table anymore!
Here's my table design.
intId is the Primary Key, there's no explicit unique constraint defined on it, has identity increment set to 1 and identity seed to 1.
I am inserting data into this table thru LINQ.
testDB.tbl_Vehicle.InsertOnSubmit(newVehicle);
testDB.SubmitChanges();
All this used to work till now, and all of a sudden it stopped working!
It now says
A duplicate value cannot be inserted into a unique index. [ Table name = tbl_Vehicle,Constraint name = PK_tbl_Vehicle ]
More info: This desktop application has 1 executable and 1 .sdf file. It was developed on Win 7 and recently was moved to Win XP system. But that shouldn't be a problem as there are other tables I am inserting into with similar logic and table design.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 SQL 探查器进行一项简单的操作,并检查插入语句上的查询是否触发。
有关再次检查数据库表的更多信息,如果可能,请设置主要 ie 标识列的种子。
Do one thin make use of SQL profiler and check the query fire on insert statement.
More on check the database Table again and if possbile set the seed for the primary i.e identity column.