Asp.net ReportViewer 为RDLC报表 传递参数

我的report 用到三个数据源,首先添加网站数据源

DataSet1_SDA_PROJECT_MEMBER
DataSet1_SDA_PROJECT_TARGET
DataSet1_SDA_SIGN_HISTORY

为report添加报表参数

把建立的网站数据源 添加到 报表数据源 ,同时在报表数据源-属性-过滤 添加报表参数过滤条件

在网页上添加ReportViewer 控件,指定到report即可

在网页内部添加代码 为ReportViewer 添加数据源 及报表参数

Me .ReportViewer2.LocalReport.DataSources.Clear()
Dim  Myyear  As   New  ReportParameter
Myyear.Name 
=  ReportViewer2.LocalReport.GetParameters.Item( 0 ).Name
Myyear.Values.Add(
" S00009 " )
ReportViewer2.LocalReport.SetParameters(
New  ReportParameter() {Myyear})
Dim  RP2_DateSourceMem  As   New  ReportDataSource( " DataSet1_SDA_PROJECT_MEMBER " , DataSet1.Tables( 0 ))
Dim  RP2_DateSourceTAR  As   New  ReportDataSource( " DataSet1_SDA_PROJECT_TARGET " , DataSet2.Tables( 0 ))
Dim  RP2_DateSourceSig  As   New  ReportDataSource( " DataSet1_SDA_SIGN_HISTORY " , DataSet3.Tables( 0 ))
ReportViewer2.LocalReport.DataSources.Clear()
ReportViewer2.LocalReport.DataSources.Add(RP2_DateSourceMem)
ReportViewer2.LocalReport.DataSources.Add(RP2_DateSourceTAR)
ReportViewer2.LocalReport.DataSources.Add(RP2_DateSourceSig)
ReportViewer2.LocalReport.Refresh()

 

 

 

你可能感兴趣的:(asp.net)