将一个ReportViewer控件用于许多不同的rdlc报表. [英] Use one ReportViewer control for many different rdlc reports.
本文介绍了将一个ReportViewer控件用于许多不同的rdlc报表.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想坚持一种单一的形式和ReportViewer
控件,并在运行时分配各种报告和数据源.快速的Google检查显示了针对此问题的多样化和复杂的解决方案,这促使我宁愿在这里提问.
I would like to stick with one single form and ReportViewer
control, and at runtime assign various reports and data sources. The diverse and complex solutions to this revealed by a quick google check prompted me to rather ask here. How can I achieve this?
推荐答案
很简单,您只需更改参数即可实现!
1.更改报告路径
Simple, you just need to change to parameter to achieve that!
1. Change Report Path
ReportViewer1.LocalReport.ReportPath = YOUR REPORT PATH
2.像这样在RDLC文件中添加具有确切DS名称的数据源
2. Add DataSource with exact DS name as defined in your RDLC file like this
var ReportDS= YOUR DATASET
ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource()
{
Name="DSNAME",
Value = ReportDS
});
完成
It''s Done
这篇关于将一个ReportViewer控件用于许多不同的rdlc报表.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文