Showing posts with label language. Show all posts
Showing posts with label language. Show all posts

Sunday, March 11, 2012

DateTime Format / Language Problem

Hi,
I'm having a problem with the datetime format in RS. I live in Canada but
want to use the "en-US" language setting because most of our clients using
the app are in the States. What I'm doing is formatting a start and end date
parameter from a .NET calendar control with "MM/DD/YYYY" before sending it
to the report for generation. If the user has "en-US" selected as their
language in IE, the report runs great. If they have "en-CA" selected as
their language, the month and day displays backwards, so Aug 25, 2004 shows
up as 24/8/2004 which crashes the report (obviously because there isn't a
24th month).
So I specified "en-US" in the report definition language property, I
included rs:ParameterLanguage=en-US in my URL call and I pasted the
following code into my global.asax file under BeginRequest to convert
threads to use "en-US":
Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
Nothing seems to be working...Am I missing something? Thanks,I just wanted to add to my post that the main toolbar is visible and
parameter toolbar is NOT visible.
Now if i hide the main toolbar, so both toolbars are hidden, the dates come
out properly and the report works regardless if the browser is set to
"en-US" or "en-CA".
Why does the visibility of the toolbars have anything to do with the way the
datetime format is displayed? We need to hide the parameter toolbar and show
the main toolbar for this particular application, but then the date gets
mixed up and the report won't work. Is this a bug?
"RS Developer" <idroppeddabomb@.hotmail.com> wrote in message
news:eXhvC$siEHA.2760@.TK2MSFTNGP15.phx.gbl...
> Hi,
> I'm having a problem with the datetime format in RS. I live in Canada but
> want to use the "en-US" language setting because most of our clients using
> the app are in the States. What I'm doing is formatting a start and end
date
> parameter from a .NET calendar control with "MM/DD/YYYY" before sending it
> to the report for generation. If the user has "en-US" selected as their
> language in IE, the report runs great. If they have "en-CA" selected as
> their language, the month and day displays backwards, so Aug 25, 2004
shows
> up as 24/8/2004 which crashes the report (obviously because there isn't a
> 24th month).
> So I specified "en-US" in the report definition language property, I
> included rs:ParameterLanguage=en-US in my URL call and I pasted the
> following code into my global.asax file under BeginRequest to convert
> threads to use "en-US":
> Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
> Nothing seems to be working...Am I missing something? Thanks,
>|||Instead of using the .NET calendar control, have you considered modifying
the SQL statement and using either 102 is ANSI (yy/mm/dd), but 103 is
British/French (dd/mm/yy).
WHERE (CONVERT(varchar(10), time, 102) = CONVERT(varchar(10),
DATEADD(dd, - 2, { fn NOW() }), 102))
CONVERT(varchar(10), CONVERT(varchar(4), DATEPART(yy, time)) + '/' +
CONVERT(varchar(2), DATEPART(mm, time)) + '/' + CONVERT(varchar(2),
DATEPART(dd, time)), 102)
Rory
"RS Developer" <idroppeddabomb@.hotmail.com> wrote in message
news:eB8BNKtiEHA.2544@.TK2MSFTNGP10.phx.gbl...
> I just wanted to add to my post that the main toolbar is visible and
> parameter toolbar is NOT visible.
> Now if i hide the main toolbar, so both toolbars are hidden, the dates
come
> out properly and the report works regardless if the browser is set to
> "en-US" or "en-CA".
> Why does the visibility of the toolbars have anything to do with the way
the
> datetime format is displayed? We need to hide the parameter toolbar and
show
> the main toolbar for this particular application, but then the date gets
> mixed up and the report won't work. Is this a bug?
>
> "RS Developer" <idroppeddabomb@.hotmail.com> wrote in message
> news:eXhvC$siEHA.2760@.TK2MSFTNGP15.phx.gbl...
> > Hi,
> >
> > I'm having a problem with the datetime format in RS. I live in Canada
but
> > want to use the "en-US" language setting because most of our clients
using
> > the app are in the States. What I'm doing is formatting a start and end
> date
> > parameter from a .NET calendar control with "MM/DD/YYYY" before sending
it
> > to the report for generation. If the user has "en-US" selected as their
> > language in IE, the report runs great. If they have "en-CA" selected as
> > their language, the month and day displays backwards, so Aug 25, 2004
> shows
> > up as 24/8/2004 which crashes the report (obviously because there isn't
a
> > 24th month).
> >
> > So I specified "en-US" in the report definition language property, I
> > included rs:ParameterLanguage=en-US in my URL call and I pasted the
> > following code into my global.asax file under BeginRequest to convert
> > threads to use "en-US":
> >
> > Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
> >
> > Nothing seems to be working...Am I missing something? Thanks,
> >
> >
>|||Rory, thanks for your suggestion. Our client requested a graphical calendar
to pick dates so unfortunately I have to use the calendar control. The
problem for some reason is tied into the visibility of the toolbars, these
are the only combinations of visibility where the date gets formatted
properly (why the visibility of the toolbar is affecting date formatting is
beyond me):
Parameter = false, toolbar=false
Parameter = true, toolbar=true
Parameter = collapse , toolbar=true
However I need:
Parameter = false, toolbar=true
but then the date gets switched to dd/mm/yyyy and the report crashes...
"Rory McCaw" <mccawr@.rogers.com> wrote in message
news:ejYdThtiEHA.4020@.TK2MSFTNGP10.phx.gbl...
> Instead of using the .NET calendar control, have you considered modifying
> the SQL statement and using either 102 is ANSI (yy/mm/dd), but 103 is
> British/French (dd/mm/yy).
> WHERE (CONVERT(varchar(10), time, 102) = CONVERT(varchar(10),
> DATEADD(dd, - 2, { fn NOW() }), 102))
> CONVERT(varchar(10), CONVERT(varchar(4), DATEPART(yy, time)) + '/' +
> CONVERT(varchar(2), DATEPART(mm, time)) + '/' + CONVERT(varchar(2),
> DATEPART(dd, time)), 102)
> Rory
> "RS Developer" <idroppeddabomb@.hotmail.com> wrote in message
> news:eB8BNKtiEHA.2544@.TK2MSFTNGP10.phx.gbl...
> > I just wanted to add to my post that the main toolbar is visible and
> > parameter toolbar is NOT visible.
> >
> > Now if i hide the main toolbar, so both toolbars are hidden, the dates
> come
> > out properly and the report works regardless if the browser is set to
> > "en-US" or "en-CA".
> >
> > Why does the visibility of the toolbars have anything to do with the way
> the
> > datetime format is displayed? We need to hide the parameter toolbar and
> show
> > the main toolbar for this particular application, but then the date gets
> > mixed up and the report won't work. Is this a bug?
> >
> >
> > "RS Developer" <idroppeddabomb@.hotmail.com> wrote in message
> > news:eXhvC$siEHA.2760@.TK2MSFTNGP15.phx.gbl...
> > > Hi,
> > >
> > > I'm having a problem with the datetime format in RS. I live in Canada
> but
> > > want to use the "en-US" language setting because most of our clients
> using
> > > the app are in the States. What I'm doing is formatting a start and
end
> > date
> > > parameter from a .NET calendar control with "MM/DD/YYYY" before
sending
> it
> > > to the report for generation. If the user has "en-US" selected as
their
> > > language in IE, the report runs great. If they have "en-CA" selected
as
> > > their language, the month and day displays backwards, so Aug 25, 2004
> > shows
> > > up as 24/8/2004 which crashes the report (obviously because there
isn't
> a
> > > 24th month).
> > >
> > > So I specified "en-US" in the report definition language property, I
> > > included rs:ParameterLanguage=en-US in my URL call and I pasted the
> > > following code into my global.asax file under BeginRequest to convert
> > > threads to use "en-US":
> > >
> > > Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
> > >
> > > Nothing seems to be working...Am I missing something? Thanks,
> > >
> > >
> >
> >
>

Thursday, March 8, 2012

Datetime conversion under diferent versions of SQL

You are probably passing dates in some regional format (e.g. dd/mm/yyyy) and
this is okay on one server (which may have British language settings) but
not on another (which may have US English language, or mdy dateformat). To
avoid these problems, always pass dates as 'YYYYMMDD'...
Aaron Bertrand
SQL Server MVP
http://www.sqlblog.com/
http://www.aspfaq.com/5006
"kTodos" <kanduru.x@.iol.pt> wrote in message
news:%23YZA%23Q6rHHA.2240@.TK2MSFTNGP03.phx.gbl...
> Hello!
> I'm using the same script to insert/update records on diferent versions of
> SQL but i'm getting this error:
> [Microsoft][ODBC SQL Server Driver][SQL Server]A converso de um tipo de
> dados char em um tipo de dados datetime resultou em um valor datetime fora
> do intervalo.
> (translation: error converting one string into datetime value out of
> range)
> The SQL versions that I am probing is 8.00.194 (RTM) that is installed
> with Microsoft SQL Personal Engine CD and ther other version is 8.00.2039
> (SP4) that i've downloaded and installed.
> Can anywone help me?
> Regards,
> kTodos
>
... and for some extra reading: http://www.karaszi.com/SQLServer/info_datetime.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OtJcSa8rHHA.1200@.TK2MSFTNGP04.phx.gbl...
> You are probably passing dates in some regional format (e.g. dd/mm/yyyy) and this is okay on one
> server (which may have British language settings) but not on another (which may have US English
> language, or mdy dateformat). To avoid these problems, always pass dates as 'YYYYMMDD'...
> --
> Aaron Bertrand
> SQL Server MVP
> http://www.sqlblog.com/
> http://www.aspfaq.com/5006
> "kTodos" <kanduru.x@.iol.pt> wrote in message news:%23YZA%23Q6rHHA.2240@.TK2MSFTNGP03.phx.gbl...
>