Wednesday, March 28, 2012

ReportViewer Control and German-Swiss date-format

Direct select on my Server gives the following three all working:
select * from tblvehicle
where dtmyearofpurchase = '2/1/1980 3:36:07 PM'
select * from tblvehicle
where dtmyearofpurchase = '02/01/1980 15:36:07'
select * from tblvehicle
where dtmyearofpurchase = '1980-02-01 15:36:07'
the only one NOT working ist the GERMAN-SWISS date-format!!!
select * from tblvehicle
where dtmyearofpurchase = '01.02.1980 15:36:07'
Unfortunately I receive this format automatically from Report-Server!!
----
Additional Info:
----
I've embedded a ReportViewer Control in a Winforms app.
I get the parameters via ReportViewer1.ServerReport.GetParameters
and show values to be chosen from in a checked listbox from
ValidValues(i).Value (chosen the values, NOT the labels!)
I run the Winform-App one time from an external us-en-Client and
one time from the same de-ch-Swiss Server
US-client: Query DOES work
- XP SP2
- all suggested automatic updates installed incl. newest ones from today
(19.06.06)
- VS2005 V. 2.0.50727
- all english Software
Language Config:
Windows XP and all running programs are us-english
First Language in Internet Explorer: en-us
Regional Options: english-us with
time: h:mm:ss tt, e.g. 11:12:36 AM
short date: M/d/yyyy , e.g. 6/19/2006
long date: dddd, MMMM dd, yyyy, e.g. Monday, June 19, 2006
Server (and at the same time Swiss-Client): Query DOES NOT work!!!
- Enterprise Server 2003R2
- all suggested automatic updates installed incl. newest ones from today
(19.06.06)
- SQL Server 2005, SP1, cumulative post SP1 hotfixes
- all english Software
Language Config:
Windows 2003R2 and all running programs are us-english
First Language in Internet Explorer: de-ch (=german switzerland)
Regional Options: german switzerland
time: HH:mm:ss, e.g. 11:18:54
short date: dd.MM.yyyy, e.g. 19.06.2006
long date: dddd, d. MMMM yyyy, e.g. Montag, 19. Juni 2006
Via SQL Server Profiler I retrieved the following data:
either requested by the ReportViewer1.ServerReport.GetParameters
or sent by the SetParameters
1. DOES work:
from ReportServer (enumeration) to external en-us client
retrieved values via GetParameters
following values from Profiler:
<Value>2/1/1980 3:36:07 PM</Value>
<Label>02/01/1980 15:36:07</Label>
Sent Query from winforms via SetParameters
also retrieved from Profiler:
@.Parameters=N'strTableName=tblVehicle&strColumnName=dtmYearOfPurchase&Suchschlussel=2/1/1980 3:36:07 PM'
2. This DOES NOT work
to self server de-ch (german switzerland)
retrieved values via GetParameters
<Value>01.02.1980 15:36:07</Value>
<Label>02/01/1980 15:36:07</Label>
Sent Query from winforms via SetParameters
@.Parameters=N'strTableName=tblVehicle&strColumnName=dtmYearOfPurchase&Suchschlussel=01.02.1980 15:36:07'
Apparently it seems all to be right...
in 1. it works = one datarow is sent back to the winform app
in 2. it doesnt work = the report is rendered but empty.Hello Henry,
In Report Layout View you can select the Properties window. You can set the
language for the report which determines formatting according to language
preferences.You can use some expression like User!Language to make the
language selection dynamic. You may test default language/US-English of
report to see differences
The locale of the parameter section is based on the browser
Accept-Language. The formatting of dates in the report is based on the
language specified in the RDL.
Note that you need to deploy the report to server to test since there is
some issue in design time reportviewer regarding this.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Thanks Peter,
we are so involved in lots of other Reporting-Services areas, that we
couldn't resolve this issue yet, despite your valuable information.
I'll come back to this problem in the next four weeks.
Yours Henry
""privatenews"" wrote:
> Hello Henry,
> In Report Layout View you can select the Properties window. You can set the
> language for the report which determines formatting according to language
> preferences.You can use some expression like User!Language to make the
> language selection dynamic. You may test default language/US-English of
> report to see differences
> The locale of the parameter section is based on the browser
> Accept-Language. The formatting of dates in the report is based on the
> language specified in the RDL.
> Note that you need to deploy the report to server to test since there is
> some issue in design time reportviewer regarding this.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> =====================================================>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>|||Hello Henry,
Thank you for taking time to write in about the status of the issue. I
understand that you have other priorities right now. If you need any
assistance from us, please feel free to post back.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Dear Peter,
the problem was found to be:
(recap)
- Enduser works in localized Windows (e.g. Regional Settings Italian)
- Enduser may have different IE-Language Setting of e.g. us_english
- Enduser may like to work in our WinForm-Application (that includes a
ReportViewer-Control) in his German Language
So:
- we configure all text in our WinForm-App to be expressed in German
- we send an @.winform-language-Parameter to Reporting-Service
- we configure in the Report all the Body-Text, Dropdown-List content,
Column-Names etc. to be in German
- we do Selects to an underlying DB via Stored-Procedures that contain
Datetime-data-types in the Where-clause
- THE RESULT-SETS ARE EMPTY!!!
Problem:
- The explicit parameter for German will not work, since Dropdown Box
ValidValues are sent in the us_english-dateformat (mdy)
- the SQL-Server Server language is swiss-German (de-CH) with its inherent
dateformat of dmy
here's the solution:
- we define an internal Parameter @.language in the RDL
- we allow blank value
- NO available Values
- Default Value is a non-queried expression:
=Iif (user!Language.StartsWith("de"),"1",Iif
(user!Language.StartsWith("en"),"2",Iif
(user!Language.StartsWith("fr"),"3",Iif
(user!Language.StartsWith("it"),"4","2"))))
- we send this @.language Parameter to any Stored Procedure
- there we set the batch-level-language (means: in the SP):
if @.language = 1 set language German
if @.language = 2 set language English
if @.language = 3 set language French
if @.language = 4 set language Italian
Drawback:
- the user chose German for her WinForm-App
- she receives ALL text in German BUT us_english Dates in Dropdown Boxes
But finally the whole thing works.
Best Regards, Henry|||Hello Henry,
Thank you for taking time to write in about your detailed workaround to
solve this issue and this shall benefit the community!
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

No comments:

Post a Comment