Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set DateTime parameter

As you can see on image below DateTime parameter type is supported in RDLC. enter image description here

I'm trying to set parameter like this but this code doesn't compile with error that there is not constructor accepting this type of arguments:

var p = new Microsoft.Reporting.WinForms.ReportParameter("ReportParameter1", DateTime.Now);
LocalReport.SetParameters(p);

Is there a way to set DateTime or even DateTime? (nullable) as parameter so it can be used for further report calculations without converting it to string ?

like image 601
Milos Avatar asked Nov 02 '22 22:11

Milos


1 Answers

None of the constuctors for ReportParameter take a DateTime. See here.

You can probably make it work with:

var p = new Microsoft.Reporting.WinForms.ReportParameter("ReportParameter1", DateTime.Now.ToString("MM/dd/yyyy"));
like image 156
Icarus Avatar answered Nov 11 '22 05:11

Icarus