Mez*_*Mez 10 c# rdlc reportingservices-2005 reporting-services
我遇到了报告服务的问题,在2005版本上运行本地rdlc文件.
我在HTML中有一个报表查看器设置为在本地运行,如下所示:
<rsweb:ReportViewer ID="ReportingServicesReportViewer" runat="server" Height="100%"
ProcessingMode="Local" ShowParameterPrompts="False" Width="100%">
</rsweb:ReportViewer>
Run Code Online (Sandbox Code Playgroud)
在代码中
// create SqlConnection
SqlConnection myConnection = new SqlConnection(ConnectionString);
myCommand.Connection = myConnection;
SqlDataAdapter da = new SqlDataAdapter(myCommand);
//get the data
DataSet data = new DataSet();
da.Fill(data);
if (data != null && data.Tables.Count > 0 && data.Tables[0].Rows.Count > 0)
{
ReportingServicesReportViewer.Visible = true;
ltrStatus.Text = string.Empty;
//provide local report information to viewer
ReportingServicesReportViewer.LocalReport.ReportPath = Server.MapPath(Report.RDLCPath);
//bind the report attributes and data to the reportviewer
ReportDataSource rds = new ReportDataSource("DataSet1", data.Tables[0]);
ReportingServicesReportViewer.LocalReport.DataSources.Clear();
ReportingServicesReportViewer.LocalReport.DataSources.Add(rds);
ReportingServicesReportViewer.LocalReport.Refresh();
}
else
{
ReportingServicesReportViewer.Visible = false;
ltrStatus.Text = "No data to display.";
}
Run Code Online (Sandbox Code Playgroud)
当执行使用报告结果填充报告查看器的方法时,没有任何内容出现,就好像报告查看器不在那里一样.
到目前为止我做了什么麻烦拍摄:
有没有人遇到类似这样的问题,有什么想法吗?
小智 9
我和VS2012有同样的问题,报告显示加载图像,然后加载完成后,报告为空白.数据存在但未呈现.
解决方案:只需将Report AsyncRendering更改为False,报告再次正常工作.
尝试使用简单的报告,有时reportviewer会抛出由无效的RDLC引起的异常并显示空报告.
还尝试调试项目并查看Visual Studio中的输出窗口:您将看到RDL引擎引发的警告,调查错误原因可能很有用.
小智 7
当我在rdlc中添加参数但未分配参数时,我遇到了同样的问题.我通过添加此代码解决了问题.
Dim p_Date As Microsoft.Reporting.WebForms.ReportParameter
p_Date = New Microsoft.Reporting.WebForms.ReportParameter("DATE", txtDate.Text)
Me.ReportViewer1.LocalReport.SetParameters(New Microsoft.Reporting.WebForms.ReportParameter() {p_Date})
ReportViewer1.LocalReport.Refresh()
Run Code Online (Sandbox Code Playgroud)
就我而言,ReportViewer 控件不提供错误消息(EventViewer 或 ReportViewer 控件主体),只是空白页面。我认为这很难找到并解决问题。Yoel Halb 的回答是我的关键!
名为 IsReadyForRendering 的属性为 False。在 BOL中指的是参数主题。
我可以用代码检查整个参数的每个值(你可以从立即窗口执行它)
var parameters = ReportViewer1.LocalReport.GetParameters()
Run Code Online (Sandbox Code Playgroud)
当您查看值为“MissingValidValue”的属性 State 时,您会发现有问题的参数
希望这可以帮助 !
| 归档时间: |
|
| 查看次数: |
56627 次 |
| 最近记录: |