Hi,
I was wondering if anyone here could help me out. I have an aspx page that has the ReportViewer control on it. I have a report that has 3 parameters used for a stored procedure. One of the parameter is a datetime parameter and it can be null. For the purposes of this iteration of the report, this parameter needs to be null.
I can not for the life of me figure out how to send over a null parameter from the aspx page. Everything I have tried gives me this error: "The value provided for the report parameter 'StartDate' is not valid for its type. (rsReportParameterTypeMismatch) "
I tried to send the parameter as "&StartDate:isnull", but that did not work. Neither did: "&StartDate=", "&StartDate=NULL", "&StartDate=<NULL>"
I'm reaching my wits end. I can't seem to find any information anywhere about sending a null parameter to ReportServer via the ReportViewer.
Any help would be greatly appreciated.
I can't find out how to pass NULL as the parameter for the report, either. The report server is based in VB, so it uses Nothing instead of Null, but I can't get it to take that, either. I'm not sure how you have the report set up, or what else you are using it for, but it may be easier if you could set NULL as the default value, and then just not pass in the date parameter.
|||I tried a sample snippet and its working,
ReportParameter rp1 =
newReportParameter("param2",newstring[] {null },false);
Add it to reportviewer control
List<ReportParameter> paramList =newList<ReportParameter>();
paramList.Add(rp2);
ReportViewer1.LocalReport.SetParameters(paramList); //replace local with server report if you are hostin your reports on reporting server
there you go on report side you can check
=IIF( IsNothing(Parameters!param2.Value),"Null value","not nul")
|||Unfortunately, I can't get the NULL to set for a default parameter in the report either. I tried, setting it equal to:
=NULL
=null
=System.DBNull
=DBNull
=isnull
=:isnull
:isnull
<NULL>
=""
=
just plain leaving it blank
I have noticed that the when going through preview, the checkbox for NULL is checked. But if I run the report, it is not defaulted to a checked state.
It seems like there would be some information about this somewhere. I have a hard time believing that no one has really found this to be an issue before.
Thanks in advance for your help
|||It looks like sundher_ganesh has come up with a working solution for sending a null value to the report. If you want a default value of null for the report, you can do one of the following:
In the report designer (At least in VS 2005) you can select Null for the default value (It's one of the three radio buttons).
Otherwise, "=Nothing" (without the quotes, of course), works for the default expression.
|||Benners_J:
It looks like sundher_ganesh has come up with a working solution for sending a null value to the report. If you want a default value of null for the report, you can do one of the following:
In the report designer (At least in VS 2005) you can select Null for the default value (It's one of the three radio buttons).
Otherwise, "=Nothing" (without the quotes, of course), works for the default expression.
Yes, he did. I guess we posted around the same time. Thanks so much sundher_ganesh and Benners_J for your help.
No comments:
Post a Comment