【问题标题】:Report Viewer exception报告查看器异常
【发布时间】:2015-04-16 08:20:18
【问题描述】:

如何在报表查看器中修复此异常? st参数报错

未处理的类型异常 'Microsoft.Reporting.WinForms.LocalProcessingException' 发生在 Microsoft.ReportViewer.WinForms.dll 附加信息:错误 在本地报告处理期间发生。

代码:

Form1 f1 = new Form1();

ReportDataSource ds = new ReportDataSource("DataSet1", dr);
f1.reportViewer1.Reset();
f1.reportViewer1.ProcessingMode =ProcessingMode.Local;
f1.reportViewer1.LocalReport.DataSources.Add(ds);
f1.reportViewer1.LocalReport.ReportPath = "clint.rdlc";
ReportParameter pr = new ReportParameter ("clint", comboBox1.SelectedItem.ToString());
f1.reportViewer1.LocalReport.SetParameters(pr);
f1.reportViewer1.RefreshReport();

【问题讨论】:

  • 哪个代码行抛出异常。
  • f1.reportViewer1.LocalReport.SetParameters(pr);
  • 嗨@Islam Gx,答案有效吗?

标签: c# reportviewer


【解决方案1】:

您应该使用SelectedText 而不是SelectedItem

之前

ReportParameter pr = new ReportParameter ("clint", comboBox1.SelectedItem.ToString());
f1.reportViewer1.LocalReport.SetParameters(pr);

之后

ReportParameter pr = new ReportParameter ("clint", comboBox1.SelectedText);
f1.reportViewer1.SetParameters(new ReportParameter[] { pr });

【讨论】:

  • Islam Gx,我编辑了我的答案,你能再试一次吗?
猜你喜欢
  • 1970-01-01
  • 2010-11-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-05-24
  • 2014-03-26
相关资源
最近更新 更多