Hi all, i am a newbie to reporting services. Hope someone can help me with this date problem.
I have a parameter date which i declared as type string in the report manager. when i entered the date as eg) "31/12/2003" and clicked on the 'preview' tab in the report manager, it gives me error saying that 'Cast from string "31/12/2003" to type 'Date' is not valid.'
So i use the cultureinfo function to set the date to 'en-US' format.... something like the one below:
CStr( Format(DateTime.Parse( Parameters!strDateTo.Value , New System.Globalization.CultureInfo("en-US")), "dd-MMM-yyyy"))
This works perfectly in my preview tab. But when i deployed to the server and when viewed on IE, it gives me an error msg -> "#Error" instead. Why is that so?
I have also checked my pc regional settings . It's set to United States and the date format is also "dd/MM/yyyy". Have also checked the settings in the server and it's also set to the same format. But i am still getting this error.
By the way... i am using windows 2003 with SRS 2000 SP2.
Any help will be appreciated. Thks !
First, why did you create a string parameter and not a date parameter? Second, the interpretation of the input is based on the language specified by the browser, which is why you got something different in the designer vs. when you deployed. Finally, if you want to evaluate strings based on a specific locale, you can just set the locale of the report (report property) to "en-US". You don't need to use a CultureInfo object.
No comments:
Post a Comment