Asp.net 文本框不接受超过50个字符?

Asp.net 文本框不接受超过50个字符?,asp.net,.net,reportviewer,rdlc,Asp.net,.net,Reportviewer,Rdlc,我使用报表查看器用于ASP.net应用程序的报表目的。 问题是,当我的表中的数据少于50个字符(DB是SQL Server)时,报表工作正常,但当数据超过50个字符时,它会给出如下错误: An error has occurred during report processing. Cannot create a connection to data source 'DataSet1'. Exception has been thrown by the target of an invocati

我使用报表查看器用于ASP.net应用程序的报表目的。 问题是,当我的表中的数据少于50个字符(DB是SQL Server)时,报表工作正常,但当数据超过50个字符时,它会给出如下错误:

An error has occurred during report processing.
Cannot create a connection to data source 'DataSet1'.
Exception has been thrown by the target of an invocation.
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. 
我不能解决这个问题,请帮忙
如果您正在使用TableAdapter,请提前感谢:

打开Dataset并选择TableAdapter


选择出现此错误的DataColumn,然后在“属性”面板中将选项
MaxLength
更改为所需大小您可以使用记事本编辑扩展名为*.xsd的数据集文件 然后更改列名/字段名的最大值

例如:

          <xs:element name="InvDesc" msprop:Generator_ColumnVarNameInTable="columnInvDesc" msprop:Generator_ColumnPropNameInRow="InvDesc" msprop:Generator_ColumnPropNameInTable="InvDescColumn" msprop:Generator_UserColumnName="InvDesc">
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:maxLength value="1000" />
              </xs:restriction>
            </xs:simpleType>
          </xs:element>

我将maxlength从50更改为1000

希望这对你有帮助


谢谢

此问题通常是由于未设置为AllowDBNull的列返回空值,或者使用相同的主键返回重复的行。您如何知道这是文本框50个字符的限制问题。请使用
try catch
异常块来处理exect错误。感谢@Rahul-当我放置的数据超过50个字符时,会出现此类错误,否则它会正常工作good@rahul我已检查是否存在空值/重复值/密钥冲突。可以,但唯一的问题是字符串长度。您是否使用
try catch
块,如果否,则使用它,您将得到确切的错误。@Rahul的评论最初来自对的回答。