【问题标题】:how can i use local parameter in rdlc report如何在 rdlc 报告中使用本地参数
【发布时间】:2020-11-12 23:39:44
【问题描述】:

我想在 rdlc 报告中使用变量名 ReportTitle 的值

我的 C# 代码是:

this.Report1.LocalReport.ReportPath = @"Report1.rdlc";
ReportParameterCollection reportParms1 = new ReportParameterCollection();
reportParms1.Add(new ReportParameter("ReportTitle", "My Report");
this.Report1.LocalReport.SetParameters(reportParms1);

rdlc 代码:

<ReportItems>
<Textbox name="ReportTitle">
<Value>=Parameters!ReportTitle.Value>
</Textbox>
</ReportItems>

我收到异常错误 setParameter()线

例外是“本地报告处理期间发生错误” 内部异常是“报告的定义无效” 内部异常是“文本框的值表达式引用了一个不存在的报表参数

【问题讨论】:

标签: c# rdlc


【解决方案1】:

在使用之前,您需要在 RDLC 中定义一个ReportParameter

<ReportParameters>
    <ReportParameter Name="ReportTitle">
        <DataType>String</DataType>
        <Prompt>ReportTitle</Prompt>
    </ReportParameter>
</ReportParameters>

在 Visual Studio 中,您还可以使用 View > Report Data 而不是直接修改 RDLC。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-27
    • 2014-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多