Reporting services 如果字段值为空,则SSRS函数返回#Error

Reporting services 如果字段值为空,则SSRS函数返回#Error,reporting-services,Reporting Services,提前感谢您提供的一切帮助 我的代码是: Public Function StripHTML(value As String) As String Return System.Text.RegularExpressions.Regex.Replace(value, "<(.|\n)*?>", "") End Function 公共函数StripHTML(值作为字符串)作为字符串 返回System.Text.RegularExpressions.Regex.Replace(值“,”)

提前感谢您提供的一切帮助

我的代码是:

Public Function StripHTML(value As String) As String
Return System.Text.RegularExpressions.Regex.Replace(value, "<(.|\n)*?>", "")
End Function
公共函数StripHTML(值作为字符串)作为字符串
返回System.Text.RegularExpressions.Regex.Replace(值“,”)
端函数
然后我从一个文本框调用这个函数。除非数据集中有空值,否则这种方法非常有效。我试图补偿空值,但RDLC文件生成一条错误消息,它无法显示子报表

Public Function StripHTML(value As String) As String
if isnothing(value) then return value 
else 
Return System.Text.RegularExpressions.Regex.Replace(value, "<(.|\n)*?>", "")
end if 
End Function
公共函数StripHTML(值作为字符串)作为字符串
如果为Nothing(值),则返回值
其他的
返回System.Text.RegularExpressions.Regex.Replace(值“,”)
如果结束
端函数
我还试图告诉它如果
null
返回
“”

我没有运气


有什么想法吗?再次感谢你

使用可空类型检查空值,它在.net 2.0及以上版本中受支持

例:

Nullable x=null;
if(x.HasValue)Console.WriteLine(“x是{0}”,x.Value);

您是否尝试将文本框值设置为这样的公式

=iif(Fields!USER_TEST.Value is nothing,"-",StripHTML(Fields!USER_TEXT.Value))
=iif(Fields!USER_TEST.Value is nothing,"-",StripHTML(Fields!USER_TEXT.Value))