开发者

Incorrect Duplicate insert problem with SQL Server CE 3.5

开发者 https://www.devze.com 2023-03-31 03:20 出处:网络
I am not able to insert data into my table anymore! Here\'s my table design. 开发者_JAVA技巧 intId is the Primary Key, there\'s no explicit unique constraint defined on it, has identity increment set

I am not able to insert data into my table anymore!

Here's my table design.

Incorrect Duplicate insert problem with SQL Server CE 3.5

开发者_JAVA技巧

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.


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.

0

精彩评论

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

关注公众号