How to set parameter values in RDLC

2019-06-24 01:21发布

I have added two text boxes for the date range in the report. To fill the values in the text boxes, I set parameters to the text boxes.

Now the date range is coming from a form named DateRange having two DateTimePickers.

How to set the value of the text boxes in rdlc equal to these DataTimePickers?

1条回答
神经病院院长
2楼-- · 2019-06-24 01:37

You can set parameter value like this.

DateTime dtStartDate = dateTimePicker1.Value;     
DateTime dtEndDate = dateTimePicker2.Value;     
ReportParameter[] params = new ReportParameter[2]; 
params[0] = new ReportParameter("StartDate", dtStartDate, false); 
params[1] = new ReportParameter("EndDate", dtEndDate, false); 
this.ReportViewer1.ServerReport.SetParameters(params);

Passing Parameters to RDLC

查看更多
登录 后发表回答