I have discovered that in SQL Reporting there might be a problem. I have a ReportViewer on my page and I am sending in parameters using the following method:
List<ReportParameter> myParams = new List<ReportParameter>();
myParams.Add(new ReportParameter("Start_Date", StartDate));
myParams.Add(new ReportParameter("End_Date", EndDate));
ReportViewer1.ServerReport.SetParameters(myParams);
This works great! But, when I try to set a parameter to null, after running that query, it maintains the previous value rather than setting it to null.
I run this code on another event that executes after the above code:
List<ReportParameter> myParams = new List<ReportParameter>();
myParams.Add(new ReportParameter("Start_Date"));
// I even tried omiting this line.
//(This is the null parameter I wish to pass)
myParams.Add(new ReportParameter("End_Date", EndDate));
ReportViewer1.ServerReport.SetParameters(myParams);
Has anyone come across a work around or a different technique to get this working?
Also if I initially do not define the parameter, then assign the parameter, then do not define the paramter, it maintains the value that was assigned. (These are all postbacks, each event)