我在 Visual Studio 2010 (C#) 中使用报表查看器加载 RDL 文件时遇到一个奇怪的问题。
我使用以下代码加载 RDL:
//get the data set and then
//.
//.
//pass the report to the viewer
using (FileStream stream = new FileStream(_AccessReportDocument.FileName, FileMode.Open))
{
this.AccessReportViewer.LocalReport.LoadReportDefinition(stream);
}
this.AccessReportViewer.LocalReport.Refresh();
问题在于,一旦上面的代码到达最后一行,代码就会跳转到页面的卸载方法,然后返回到 this.AccessReportViewer.LocalReport.Refresh(); 即无限循环.有谁之前经历过这个吗?我已经读到 vs 2010 的报告查看器存在问题,但主要是设置参数,我还没有尝试做......
调试显示所有数据集等都可以正常检索 - 所以这不是问题所在。
最佳答案
如果您在设置数据源时没有检查回发,VS2010 可能会发生这种情况。这是因为对报表查看器进行了更改以异步加载数据。完整解释在这里:
关于c# - WebForm.ReportViewer 无限循环问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8854017/