且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-02-16 12:26:54

很简单,您只需更改参数即可实现!

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