将参数传递到报表查看器中的报表

时间:2010-02-05 17:55:47

标签: reportviewer

如何将参数传递给报告?不是窗户 表单和参数是一个字节的图像数组?

我也需要这样做,如果有人知道的话,请!!

谢谢,

1 个答案:

答案 0 :(得分:-1)

var reportParameterCollection = new ReportParameter[3];
reportParameterCollection[0] = new ReportParameter { Name = "StartDate", Values = { DateTime.Now.AddDays(-3).ToShortDateString()} };
reportParameterCollection[1] = new ReportParameter { Name = "EndDate", Values = { DateTime.Now.ToShortDateString() } };
reportParameterCollection[2] = new ReportParameter { Name = "Customer_ID", Values = { 3 } };
reportViewer.ServerReport.SetParameters(reportParameterCollection);
reportViewer.ServerReport.Refresh();