Showing posts with label reportparameter. Show all posts
Showing posts with label reportparameter. Show all posts

Monday, February 20, 2012

Problem with DateAdd and ReportParameter

Hi there,
I'm trying to use a a ReportParameter in CommandText. Usually this works
fine, but together with the DateAdd-Function I've a problem. When I use the
following query everything works fine
= "SELECT Datum1, Datum2 From Table WHERE DATEADD(year, 20, Datum1 >
Datum2"
When I change this to
= "SELECT Datum1, Datum2 From Table WHERE DATEADD(year, " +
Parameters!Jahr.Value + ", Datum1 > Datum2"
I am not able to do a preview of my report. Does anybody know what to do, to
make it work?Try using & instead of +
= "SELECT Datum1, Datum2 From Table WHERE DATEADD(year, " &
Parameters!Jahr.Value & ", Datum1) > Datum2"
Bruce Johnson [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Betina Keiner" <BetinaKeiner@.Gradient.de> wrote in message
news:eMk1yj$bEHA.2812@.TK2MSFTNGP11.phx.gbl...
> Hi there,
> I'm trying to use a a ReportParameter in CommandText. Usually this works
> fine, but together with the DateAdd-Function I've a problem. When I use
the
> following query everything works fine
> = "SELECT Datum1, Datum2 From Table WHERE DATEADD(year, 20, Datum1
> Datum2"
> When I change this to
> = "SELECT Datum1, Datum2 From Table WHERE DATEADD(year, " +
> Parameters!Jahr.Value + ", Datum1 > Datum2"
> I am not able to do a preview of my report. Does anybody know what to do,
to
> make it work?
>