字符串的长度值超过长度在映射/参数配置

来源:互联网 发布:淘宝买反恐精英号 编辑:程序博客网 时间:2024/05/22 15:43

 

字符串的长度值超过长度在映射/参数配置??

 

数据库设置的参数为max ,同样的参数单独在存储过程中执行,是成功的。

在程序中就报错了??

 

 

sql中 nvachar类型

 nvarchar(n)
包含 n 个字符的可变长度 Unicode 字符数据。n 的值必须介于 1 与 4,000 之间。字节的存储大小是所输入字符个数的两倍。

 

 

   这上面的方式设置data 重了,SetString方法  字符有限制的。

用这种方法传参数类型为 StringClob SetParameter("data", data, NHibernate.NHibernateUtil.StringClob).

 

 

查询相关资料:

NHibernate 3.3 中如何存储长于4000字符的字符串

在NHibernate 3.3 中存储的字符串太长,会抛异常:The length of the string value exceeds the length configured in the mapping/parameter.

有人会说这是新版NHibernate的一个Bug,3.2就不会出现这样的情况。实际上,对于string类型的属性值,NHibernate默认值最大值是4000个字符,在3.2中会自动截断,在3.3中会给你抛一个异常出来,所以这并不是一个Bug,如果你想存储超过4000个字符的字符串,请在映射文件中修改该属性的类型,使用 type="StringClob" 

?
<property name="myProp"column="MY_PROP"not-null="true"type="StringClob"access="property"></property>
 
 
 
 
<property name="OldValue" type="string">   <column name ="OldValue" length="2147483647" not-null="false"/></property>
 
 
 
Tell me more×                 
            Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.        

The length of the query string for this request exceeds the configured maxQueryStringLength value

<system.web> <httpRuntime      <maxQueryStringLength="**MY NUMBER**"/>  /></system.web