此 SqlParameterCollection 的 Count=4 的索引 4 无效。
来源:互联网 发布:php erp系统 编辑:程序博客网 时间:2024/03/29 16:40
NHibernate在做Update()时,报错: 此 SqlParameterCollection 的 Count=4 的索引 4 无效。
原因:
mapping.Map(u => u.OrganizationId).Column("OrganizationId");
mapping.References(u => u.Organization).Column("OrganizationId").NotFound.Ignore();
将OrganizationId列映射了两次。
解决方案:
试了一下,改成
mapping.Map(u => u.OrganizationId).Column("OrganizationId").Not.Insert().Not.Update();
mapping.References(u => u.Organization).Column("OrganizationId").NotFound.Ignore();
或
mapping.Map(u => u.OrganizationId).Column("OrganizationId");
mapping.References(u => u.Organization).Column("OrganizationId").NotFound.Ignore().Not.Insert().Not.Update();
都可以。
参考:
http://stackoverflow.com/questions/8062068/nhibernate-error-message-invalid-index-3-for-this-sqlparametercollection-with-c
http://stackoverflow.com/questions/18125692/invalid-index-6-for-this-sqlparametercollection-with-count-6
0 0
- 此 SqlParameterCollection 的 Count=4 的索引 4 无效。
- 安卓 此 SqlParameterCollection 中未包含带有 ParameterName“@RETURN_VALUE”的 SqlParameter。
- 无效的列索引
- 无效的列索引
- 查询无效的索引
- 实例化SqlParameterCollection的方法是
- count(*), count(1) ,count(唯一键索引),count(非唯一键索引),count(存在null索引)的效率
- 此证书的签发者无效
- 此证书的签发者无效
- ios-此证书的签发者无效
- 此证书的签发者无效
- 此证书的签发者无效 问题解决
- 此证书的签发者无效
- 此证书的签发者无效
- 此证书的签发者无效
- 此证书的签发者无效
- 此证书的签发者无效
- 此证书的签发者无效
- C、C++和MFC中文件的读写方法
- 二叉排序树算法
- UITouch(包括视图移动的实现)
- 最少生成树算法
- VM tools安装错误The path "" is not a valid path to the xx generic kernel headers.
- 此 SqlParameterCollection 的 Count=4 的索引 4 无效。
- 中文乱码在java中URLEncoder.encode方法要调用两次解决
- 数据结构之Chain类
- 第二章 创建对话框 2.3快速设计对话框
- 最简单zTree应用案例
- strcmp函数
- 腾讯2014春季实习生招聘 笔试题目 第一批次
- A - Lotto
- 【并查集】hdu 1856 More is better