【发布时间】:2016-04-29 18:11:31
【问题描述】:
我将 Report Viewer 用于我的 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.
我无法解决问题,请帮助 提前致谢
【问题讨论】:
-
这个问题通常是由于没有设置为 AllowDBNull 的列返回空值,或者使用相同的主键返回重复的行。你怎么知道这是一个文本框 50 个字符的限制问题。使用
try catch执行错误的异常块。 -
感谢@Rahul - 当我输入超过 50 个字符的数据时,它会给我这样的错误,否则效果很好
-
@rahul 我检查了空值/重复值/键违规。没关系,但唯一的问题是字符串长度
-
你是否使用
try catchblock,如果没有使用它,你会得到确切的错误。
标签: asp.net .net reportviewer rdlc