I am getting following error for my Reporting Services report
:
Microsoft.Reporting.WinForms.ReportServerException: 'The value provided for the report parameter 'ActionOwnerDate_from' is not valid for its type. (rsReportParameterTypeMismatch)'
That error is thrown on this line:
reportViewer1.ServerReport.SetParameters(rptParameters);
Part of code where error occurs:
Note that ToString()
has to be there as ReportParameter
argument requires string value.
var rptParameters = new List<ReportParameter>
{
new ReportParameter("ActionOwnerDate_from",
DateTime.Now.AddYears(-10).AddDays(-8).ToString("dd-MM-yyyy")),
new ReportParameter("ActionOwnerDate_to", DateTime.Now.AddDays(-10).ToString("dd-MM-yyyy"))
};
reportViewer1.Invoke((MethodInvoker)(() => {
reportViewer1.ShowParameterPrompts = false;
reportViewer1.ServerReport.SetParameters(rptParameters);
reportViewer1.ServerReport.Refresh();
reportViewer1.RefreshReport();
}));
Note that:
The ActionOwnerDate_from
parameter datatype is Date/Time
The Report localization's language
is set to: en-US
.
Screnshoots from the debugger: