報錯信息:Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities we ...
報錯信息:Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=472540 for information on understanding and handling optimistic concurrency exceptions.
原因:主鍵id未設置自增,導致插入失敗。
解決方案:表的主鍵id設置自增。
mysql設置方式:在表上右鍵-->設計表-->選中主鍵id-->勾選即可。
sqlserver設置方式:在表上右鍵-->設計表-->選中主鍵id-->雙擊“(是標識)”的值,改為是,標識增量和標識種子設置為1即可。