在使用MVC框架,向数据库中的表格插入一条数据时,出现以下问题:

Unable to update the EntitySet '***'because it has a DefiningQuery and no element exists in the element to support the current operation.

注:上面*部分标示你要插入的数据库实体类名。

这个问题是在使用AdO.NET Entity Framework的时候,你使用的“XXX”这张表在数据库没有定义主键,只要设置了主键,就不会出现这个异常或这个错误了。

相关文章:

  • 2022-02-13
  • 2021-12-10
  • 2021-07-22
  • 2022-12-23
  • 2021-08-01
  • 2021-10-13
  • 2021-09-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-03
  • 2021-09-27
  • 2022-12-23
  • 2021-12-03
相关资源
相似解决方案