RDLC 报告不断加载而不显示数据

本文关键字:显示 数据 报告 RDLC 加载 | 更新日期: 2023-09-27 18:37:13

我想通过手动将值填充到数据集来生成 rdlc 报告,因为我将日期作为查询的输入发送。我使用以下代码来执行此操作

//my list get populated with the relevant records according to its date and I'm using the tableadapter of my dataset to do that
List<DailySalesEntity> list = DailySalesHandler.GetSalesByDate(dateTimePicker1.Value);
            reportViewer1.LocalReport.DataSources.Clear();
            Microsoft.Reporting.WinForms.ReportDataSource report = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet_Dailysales", list);
            reportViewer1.LocalReport.DataSources.Add(report);
            reportViewer1.LocalReport.Refresh();

.我正在使用 Tablix 通过数据集显示我的数据。我已将正确的报表设置为报表查看器。我没有任何例外。但报表会继续加载,并且不显示报表。我做错了什么。

如何通过将参数传递给查询来填充数据集,并在报表中使用生成的数据集?

RDLC 报告不断加载而不显示数据

我只是遇到了这个问题并解决了它。装载标志不断显示,从未消失。就我而言,问题是我没有处理IsPostBack值。LocalReport.Refresh()会生成回发,如果未处理,它将继续发布和发布。

这是我的问题。通过墙Refrеsh页面继续做PostBacks

protected void Page_Load(object sender, EventArgs e)
{
    // Report data source code...
    myReport.LocalReport.Refresh();
}

溶液:

protected void Page_Load(object sender, EventArgs e)
{
    if(!IsPostBack)
    {
        // Report data source code...
        myReport.LocalReport.Refresh();
    }
}

因此,请检查您正在处理回发并且没有获得无限循环。