Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 Date parameter value..

Author  Topic 

moodi_z
Starting Member

38 Posts

Posted - 2009-03-08 : 09:49:06
Hi,

I'm facing a problem when choosing a date from date parameter.. sometimes the format of the date is mistaken. For example:

If I choose 02/01/2009 (dd/mm/yyy), the value of he date parameter turne to 01/02/2009!!!

If I choose it again, it gets the wright value!

What is the problem?

Thanks in advanced.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-08 : 13:03:13
whats the language settings set for report. it should be english (UK) if you want dd/mm/yyyy format.
The problem can still occur when you use calendar control in preview mode which is a known issue.
Go to Top of Page

moodi_z
Starting Member

38 Posts

Posted - 2009-03-09 : 05:10:10
OK, thanks.

By the way the problem also exists in run mode, not only preview!
In order to avoid error message when choosing the date I wrote this code when sending the value to the stored procedure:

=Format(CDate(Parameters!From_Date.Value), "s")

[ Format(CDate(Parameters!From_Date.Value), "dd/mm/yyy") gives an error! ]


See: http://www.geoffseymour.com/sql-server-reporting-services-calendar-control-for-date-parameter-ssas-olap.html/
Go to Top of Page

moodi_z
Starting Member

38 Posts

Posted - 2009-03-09 : 08:11:31
more about the problem...

In one computer we get an error message (from preview or run mode in visual studio) when choosing date from calendar control, and in other one not!

After checking I noticed that the date format in SQL is US (mm/dd/yyy) and in the regional options of the computer is UK (dd/mm/yyy).. when changing the regional options to mm/dd/yyy we stopped getting that error message but somthing strange is going, in one control we get the value in US format and in the other in UK format (there are two calendars in the reports - From/To)...

Before I move to Text field instead of calendar, is there anyway to solve it (even if the two formats of SQL server and local computer aren't the same - because we dont know what is installed in the cusstomer computer)?

Thanks in advanced.
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-03-09 : 08:35:40
Use yyyymmdd format. Thats the ISO format.
Go to Top of Page

moodi_z
Starting Member

38 Posts

Posted - 2009-03-09 : 09:04:01
I tried but it doesn't work :S

It works when the regional options of date on the computer are the same as the SQL server (2005) format (the format is fixed when installing SQL server).
Once I changed the regional options to US it stopped working and I got the error message:
"Error converting data type nvarchar to datetime"

I avoid it by writing this:
=Format(CDate(Parameters!From_Date.Value), "s")

In my computer it's working well, in another one we still get error message!!!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-10 : 05:02:02
quote:
Originally posted by moodi_z

I tried but it doesn't work :S

It works when the regional options of date on the computer are the same as the SQL server (2005) format (the format is fixed when installing SQL server).
Once I changed the regional options to US it stopped working and I got the error message:
"Error converting data type nvarchar to datetime"

I avoid it by writing this:
=Format(CDate(Parameters!From_Date.Value), "s")

In my computer it's working well, in another one we still get error message!!!


you dont need to use format() while sending values to procedure
your regional language options of computer running report should be set to english (uk)
also report language settinmgs should also be set to english (uk)
then it should work fine.
Go to Top of Page

manfred100
Starting Member

3 Posts

Posted - 2009-06-24 : 08:03:15
We had the same problem, I think.
In our case, after installation of the service pack 2 (or higher), the problem was solved. Which service pack do you use?
Go to Top of Page
   

- Advertisement -