报告查看器中的空白字段
嘿!我有一个表单应用程序,并且使用报告查看器。我设置了一些参数,但是当我想显示字段时,在我的报告中我看不到任何内容,只有页眉和页脚以及参数值,因此在我的数据集中我有值。
这是我的代码:
reportViewer1.ProcessingMode = ProcessingMode.Local;
reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Dataset1", Dataset1.Tables[0]));
reportViewer1.LocalReport.ReportPath = @"Report1.rdlc";
ReportParameter[] parameters = new ReportParameter[4];
parameters[0] = new ReportParameter("datastart",dateTimePickerStartRaport.Text);
parameters[1] = new ReportParameter("dataStop", dateTimePickerStopRaport.Text);
parameters[2] = new ReportParameter("TotalI", TotalI.ToString());
parameters[3] = new ReportParameter("TotalD", TotalD.ToString());
this.reportViewer1.LocalReport.SetParameters(parameters);
reportViewer1.LocalReport.Refresh();
reportViewer1.RefreshReport();
我不知道问题出在哪里。在另一份报告中,我做了同样的事情,但不使用参数并且它有效!
使用参数引用显示的字段时是否存在某些可见性属性或其他内容?
谢谢!
HY! I have a form application and I use report viewer. I set some parameters, but when I want to display the fields, in my report I don`t see anything, only my header and footer and the parameters value, thus in my dataset I have values.
Here is my code:
reportViewer1.ProcessingMode = ProcessingMode.Local;
reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Dataset1", Dataset1.Tables[0]));
reportViewer1.LocalReport.ReportPath = @"Report1.rdlc";
ReportParameter[] parameters = new ReportParameter[4];
parameters[0] = new ReportParameter("datastart",dateTimePickerStartRaport.Text);
parameters[1] = new ReportParameter("dataStop", dateTimePickerStopRaport.Text);
parameters[2] = new ReportParameter("TotalI", TotalI.ToString());
parameters[3] = new ReportParameter("TotalD", TotalD.ToString());
this.reportViewer1.LocalReport.SetParameters(parameters);
reportViewer1.LocalReport.Refresh();
reportViewer1.RefreshReport();
I don`t know where it is the problem. In an other report I do the same thing, but without using parameters and it works!
Is some visibility property or something when using parameters referring the fields displayed?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须区分字段和参数。参数必须在“报告数据”窗口的参数部分中声明,然后才能使用它们,并使用不同的语法在表达式中访问它们。要在表达式中使用它们,请使用以下语法:
在 VS 的表达式设计器中,有一个名为“参数”的特殊类别。如果您与设计器一起构建表达式,则可以在那里选择它们。
You have to distinguish between fields and parameters. Parameters must be declared in the Parameters-Section of the "Report Data"-window before they can be used and have a different syntax to access them in expressions. To use them in expressions, use the following syntax:
In the expression-designer of VS you have a special category called "Parameters". If you build your expressions with the designer, you can select them there.