RDLC winforms报告不会显示数据

时间:2013-11-13 15:38:46

标签: c# winforms reportviewer rdlc

伙计们,我有一个使用报告向导创建的报告。我将患者ID从Form1传递给Form2,Form2承载报告查看器。报告显示标题,我将参数传递给查询。但是它根本不显示任何数据。这是背后的代码。当我设置断点时,PatientID肯定不为空。

        public BPReport(string PatientIDVal)
    {
        InitializeComponent();

        string PatientID = PatientIDVal.ToString();
        DateTime StartDate = Convert.ToDateTime(DateTime.Today.ToShortDateString()).AddDays(-30);
        DateTime EndDate = Convert.ToDateTime(DateTime.Today.ToShortDateString());

        txtPatientID.Text = PatientID.ToString();
        dtpStartDate.Value = Convert.ToDateTime(StartDate.ToShortDateString());
        dtpEndDate.Value = Convert.ToDateTime(EndDate.ToShortDateString());

        ReportParameter[] param = new ReportParameter[3];
        param[0] = new ReportParameter("StartDate", StartDate.ToString());
        param[1] = new ReportParameter("EndDate", EndDate.ToString());
        param[2] = new ReportParameter("PatientID", PatientID.ToString());

        this.reportViewer1.LocalReport.SetParameters(param);
        this.reportViewer1.RefreshReport();
    }

1 个答案:

答案 0 :(得分:0)

通过完全重新开始创建报告来解决这个问题。我废弃了所有东西,再次做了,现在它可以工作了。我怀疑这正是驻场专家可能会告诉我的。