Store update, insert, or delete statement affected an unexpected number of rows ({0}).
问题描述
Store update, insert, or delete statement affected an unexpected number of rows ({0}). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.
存储区更新、插入或删除语句影响到了意外的行数({0})。实体在加载后可能被修改或删除。刷新 ObjectStateManager 项。
原因分析
使用 Entity Framework 更新记录时出现上述异,原因是 Model 或 Entity 实体对象的 Key 值没有赋值,无法在数据库对应表中找到对应的记录,也就无法执行更新操作。
一:View中无此列绑定, MODEL中列加了[ScaffoldColumn(false)] 是否自动加入隐藏绑定文本
二:MODEL中设置了绑定除外
解决办法
在 View 视图中添加一个隐藏的 Key 值,如:@Html.HiddenFor(model => model.id)
还有不要在model中有[Bind(Exclude=" key 列")]这样的话就算你加了这个隐藏列也不行,这个就是绑定时排除啊,你还怎么绑定。。。
Store update, insert, or delete statement affected an unexpected number of rows ({0}).的更多相关文章
- system.Data.Entity.Infrastructure.DbUpdateConcurrencyException: Store update, insert, or delete statement affected an unexpected number of rows (0) 问题
页面控件没有做限制.提交后还可以继续点击,造成了在短时间内的多次请求.查看日志两次错误在200ms之内. 错误信息 system.Data.Entity.Infrastructure.DbUpdate ...
- Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded.
EF6进行Insert操作的时候提示错误 Store update, insert, or delete statement affected an unexpected number of rows ...
- The use of function Merge (update、insert、delete)
1.The use of function merge(update.insert.delete) Example: #1.Initialize the data create table #test ...
- SQL server触发器中 update insert delete 分别给写个例子被。
SQL server触发器中 update insert delete 分别给写个例子以及解释下例子的作用和意思被, 万分感谢!!!! 主要想知道下各个语句的书写规范. INSERT: 表1 (ID, ...
- 执行update, insert,delete 语句, 不返回结果集,(类型化参数)
/// <summary> /// 执行update, insert,delete 语句, 不返回结果集,(类型化参数) /// </summary> /// <para ...
- Oracle 增删改(INSERT、DELETE、UPDATE)语句
Ø 简介 本文介绍 Oracle 中的增删改语句,即 INSERT.DELETE.UPDATE 语句的使用.是时候展现真正的技术了,快上车: 1. 插入数据(INSERT) 2. 修改数据( ...
- using the library to generate a dynamic SELECT or DELETE statement mysqlbaits xml配置文件 与 sql构造器 对比
https://github.com/mybatis/mybatis-dynamic-sql MyBatis Dynamic SQL What Is This? This library is ...
- SQL SERVER 2005删除维护作业报错:The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_job_id"
案例环境: 数据库版本: Microsoft SQL Server 2005 (Microsoft SQL Server 2005 - 9.00.5000.00 (X64) ) 案例介绍: 对一个数据 ...
- 懒人小工具:自动生成Model,Insert,Select,Delete以及导出Excel的方法
在开发的过程中,我们为了节约时间,往往会将大量重复机械的代码封装,考虑代码的复用性,这样我们可以节约很多时间来做别的事情.最近跳槽到一节webform开发的公司,主要是开发自己公司用的ERP.开始因为 ...
随机推荐
- [BZOJ 3218] A + B Problem 【可持久化线段树 + 网络流】
题目连接:BZOJ - 3218 题目分析 题目要求将 n 个点染成黑色或白色,那么我们可以转化为一个最小割模型. 我们规定一个点 i 最后属于 S 集表示染成黑色,属于 T 集表示染成白色,那么对于 ...
- linux哪个版本好
我给出的意见:目前主流和常用的Linux版本主要有:1.Redhat 版本5.5和6.0最新:培训.学习.应用.知名度最高的Linux发行版本,对硬件兼容性来说也比较不错,版本更新很快,对新硬件和新技 ...
- 学习VI的强文,新工作需要呀
http://www.gentoo.org/doc/zh_cn/vi-guide.xml :set nu//用于给文本加行号的. :set nocompatible //启用 vi 兼容模式,一般是给 ...
- 【POJ3415】 Common Substrings(后缀数组|SAM)
Common Substrings Description A substring of a string T is defined as: T(i, k)=TiTi+1...Ti+k-1, 1≤i≤ ...
- Guava的一些总结
guava是java API蛋糕上的冰激凌(精华). 源码包的简单说明: com.google.common.annotations:普通注解类型. com.google.common.base: ...
- 集成activiti-modeler 到 自己的业务系统
本文目的: 将activit 5.12.1 的 modeler 流程设计器 集成到自己的工程中去 解决问题: 1. 复制相关资源文件到自己的工程中 2. 解决modeler的路径访问问题,迁移到非系统 ...
- cocos2d-iphone加入芒果广告
cocos2d-iphone加入芒果广告的时候在模拟器上显示不出广告 真机上却可以.提示信息如下: AdsMoGo don't start alternate ADDRESPONSE - ADDING ...
- UVA 11624 Fire!(二次BFS)
先对火BFS一次,求出每个点的最小着火时间. 再对人BFS一次,求出走到边界的最少时间. #include <iostream> #include <queue> #inclu ...
- wpf 异步使用
方法前加 asyc,同步方法掉异步方法 public void Init() { buildUI(); } // await 只能用在异步方法上面 public async void buildUI( ...
- Linux Shell编程(24)——命令替换
命令替换 将会重新分配一个命令[1]甚至是多个命令的输出; 它会将命令的输出如实地添加到另一个上下文中. [2]使用命令替换的典型形式是使用后置引用(`...`). 后置引用形式的命令(就是被反引号括 ...