【问题标题】:Windows form RDLC report parameter in VB.NETVB.NET 中的 Windows 窗体 RDLC 报告参数
【发布时间】:2012-03-20 19:34:08
【问题描述】:

我正在开发一个 Windows 应用程序,无法创建 RDLC 本地报告。

报告中只有 2 个文本框,一个是员工姓名,另一个是地址。

一切正常,但我不知道如何传递 RDLC 报告变量并在报告文本框或报告中显示其值。

谢谢

【问题讨论】:

    标签: windows vb.net winforms report rdlc


    【解决方案1】:

    查看这篇文章:

    Using the WinForms ReportViewer Control

    编辑:

    假设您有一个文本框控件“TxtParameter”,您可以在其中输入员工的社会安全号码。

        'Create a report parameter for the sales order number 
        Dim rpEmployeeSSN As New ReportParameter()
        rpEmployeeSSN.Name = "SocialSecurityNumber"
        rpEmployeeSSN.Values.Add(TxtParameter.Text)
    
        'Set the report parameters for the report
        Dim parameters() As ReportParameter = {rpEmployeeSSN}
        localReport.SetParameters(parameters)
    
        'Refresh the report
        reportViewer1.RefreshReport()
    

    【讨论】:

    • 嘿@Nathan 感谢您的回复,我已经完成了所有设置,并且当我运行应用程序时可以看到空白的reportViewer,但无法将参数传递给rdlc。谢谢
    【解决方案2】:
        *****Me.movingselectedTableAdapter.Fill(Me.LRCDBDataSet.movingselected)
        '+++++++++++++ passing parameter
        Dim repdate As Date = System.DateTime.Now.ToShortDateString()
        Dim params(0), myparam As ReportParameter
         '++++++++++++++++++try2
        Dim myparams As New List(Of ReportParameter)
        myparam = New ReportParameter("rptcrdate", repdate)
        myparams.Add(myparam)
        'Report_Parameter_1
        ReportViewer1.LocalReport.SetParameters(myparams)
        Me.ReportViewer1.RefreshReport()*****
    

    【讨论】:

    • 考虑在答案中添加更多信息。上面这段代码有什么作用?
    猜你喜欢
    • 1970-01-01
    • 2020-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-27
    • 2023-03-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多