将一个ReportViewer控件用于许多不同的rdlc报表.

编程入门 行业动态 更新时间:2024-10-22 03:01:59
本文介绍了将一个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报表.

本文发布于:2023-10-28 01:08:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1535053.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   报表   ReportViewer   rdlc

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!