SQL Server CE 3.5的重复插入问题不正确

时间:2011-08-25 05:32:38

标签: winforms linq sql-server-ce

我无法再将数据插入我的表格了! 这是我的桌子设计 enter image description here

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系统。但这应该不是问题,因为我正在使用类似的逻辑和表格设计插入其他表格。

1 个答案:

答案 0 :(得分:0)

使用SQL Profiler进行一次精简,并在insert语句中检查查询。

更多关于再次检查数据库表,如果可能,则设置主要即标识列的种子。

相关问题