报错信息: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即可。