Showing posts with label according. Show all posts
Showing posts with label according. Show all posts

Sunday, March 25, 2012

date picker in RS doesn't follow regional setting

hi all,
i've just updated my sql server 2005 with sp1 and sp2.
i want my report date format to change according to regional setting,
therefore i've set the report property for language as User.Language.
i've also enter the format i wanted in IE option..
how do i set the report parameter of type datetime to follow the
format of regional setting?
my date parameter has default value which i query from a table.
for e.g. if my regional setting is UK and the default date is
9/7/2006, the date picker will display date at 7 september 2006
instead.
please help... thanks!anybody?|||https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=271928
The following solution helped me:
Change Culture for your reportserver page.
Edit the ReportViewer.aspx webpage. It usually in this directory:
"%ProgramFiles%\Microsoft SQL Server\MSSQL.2\Reporting
Services\ReportServer\Pages\"
Add Culture attribute to the @.Page declaration like this:
<%@. Page Language="C#" AutoEventWireup="true"
Inherits="Microsoft.ReportingServices.WebServer.ReportViewerPage"
Culture="de-DE" %>
Regards,
Stefan
"minority" <kokpenglow@.gmail.com> schrieb im Newsbeitrag
news:1181787881.409498.256650@.g37g2000prf.googlegroups.com...
> anybody?
>|||Thanks Stefan.
Worked great for me en-GB
Paul Cahill
"Stefan" <stefan@.nospam.nospam> wrote in message
news:e#k506$tHHA.4572@.TK2MSFTNGP02.phx.gbl...
> https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=271928
> The following solution helped me:
> Change Culture for your reportserver page.
> Edit the ReportViewer.aspx webpage. It usually in this directory:
> "%ProgramFiles%\Microsoft SQL Server\MSSQL.2\Reporting
> Services\ReportServer\Pages\"
> Add Culture attribute to the @.Page declaration like this:
> <%@. Page Language="C#" AutoEventWireup="true"
> Inherits="Microsoft.ReportingServices.WebServer.ReportViewerPage"
> Culture="de-DE" %>
>
> Regards,
> Stefan
>
> "minority" <kokpenglow@.gmail.com> schrieb im Newsbeitrag
> news:1181787881.409498.256650@.g37g2000prf.googlegroups.com...
>> anybody?
>

date picker format

hi all,

i've just updated my sql server 2005 with sp1 and sp2.

i want my report date format to change according to regional setting, therefore i've set the report property for language as User.Language.

how do i set the report parameter of type datetime to follow the format of regional setting?

my date parameter has default value which i query from a table.

for e.g. if my regional setting is UK and the default date is 9/7/2006, the date picker will display date at 7 september 2006 instead.

please help.... thanks!

i've also enter the format i wanted in IE option..

|||If you have a parameter of datetime, and the report language setting is user!langauge, and the datetime in IE is not coming out as expected, then you do not have you local regional settings set up correctly.|||

thanks for your reply adolf...

my pc regional setting:

Regional Options tab:

Standard and formats:

English (United Kingdom)

Short date: 14/06/2007

Long date: 14 June 2007

Location: United Kingdom

Advanced tab:

Language for non-Unicode programs:

English (United Kingdom)

anywhere else to check? thanks!

|||In IE but I think you said you already checked this:

IE: tools - options - general - [languages...] -

There may be something else to check, if the above doesn't work let me know and I'll try and find out|||

in IE, Language: English (United Kingdom) [en-gb]

still not working... is it because of the default value of the parameter? but it's displaying the correct format for the date... Sad

thanks for your help

Sunday, March 11, 2012

date function in C#

hi experts,

i'm working in a web page for some statistics and i have a calendar where the customer can choose a day a week or a month and according to the date he select i need to query the database according to the date selected.

what i want to know is how can i store the date for a day in a variable so i can call it from a stored procedure, the day actually is easy what i want is how can i store the whole week in a variable so i can give it to the stored procedure and query the data in the database according to the whole week may be with startday and endday

also the same problem for the whole month, any idea how can i implement that in C#?!!!

thanks

Are you asking how would you query by a date range? such as a week?

-c

|||

thanks for your reply, what i wnat is how can i store the value of the whole week and month in a variable. i know how to query the database. the situation is as follow:

i have a web site where a client can select a day week or a month to see some statistics, for the day i know how to do it. and i have also stored procedures. what i want is how to store the startday and end day in a variable when the client select a week or a month, so i can assign these variables to the stored procedure so the stored procedure can query the database and return the data for just the specific selected date.

i hope i made my self clear.

any help will be appreciated.

thanks

|||

mrjoka

Check out the article below and look for the sample function called RunStoredProcParams here you will see how to return a datareader from a stored procedure that accepts a parameter

http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson07.aspx

HTH

|||

thanks for the link, actually what i want is how to store the date value of the selected week or month from a callendar in a variable so i can assing them to a stored procedure. i know how to assign parameters to SP but how can i store the startdate and enddate selected from the user from the callendar? for example if the user select a week or a month for a day i can use :date1 = Calendar1.SelectedDate.ToShortDateString(); but for a week or a month!!!!

this is what makes me crazy these days

thanks in advance

|||

Since the SelectedDate is a DateTime variable you can do this for month;

int SelectedMonth = Calendar1.SelectedDate.Month;

The week can be done as follows

System.Globalization.Calendar cal = System.Globalization.CultureInfo.CurrentCulture;int SelectedWeek = cal.GetWeekOfYear;
|||

thanks for the reply it realy helps but when i tried the week i had these fouts:

Error 1 Cannot implicitly convert type 'System.Globalization.CultureInfo' to 'System.Globalization.Calendar'

Error 2 Cannot convert method group 'GetWeekOfYear' to non-delegate type 'int'. Did you intend to invoke the method?

any idea why?

thanks again

|||

yes, I forgot the .Calendar on the CultureInfo - so its = System.Globalization.CultureInfo.CurrentCulture.Calendar;

System.Globalization.Calendar cal = System.Globalization.CultureInfo.CurrentCulture.Calendar;

That will fix both issues.

-c

|||

thanks for the quick reply,

i did wat you told me and i get rid of the first fout but the second one is still there

any idea

thanks

|||

my bad - you need to add () to the call;

int SelectedWeek = cal.GetWeekOfYear();
|||

sorry to bother you again,

here is the fout this time:

Error 1 No overload for method 'GetWeekOfYear' takes '0' arguments

is it because i'm using it inside a case statement?!!!

thanks

|||

here you go;

int SelectedWeek = System.Globalization.CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(Calendar1.SelectedDate, System.Globalization.CalendarWeekRule.FirstFullWeek, DayOfWeek.Monday);
-c|||

do i need to declareDayOfWeek because it gave me this error:

Error 1 The name 'DayOfWeek' does not exist in the current context

thanks

|||

thanks man it works like a charm

|||

DayOfWeek is under System and is an enumeration so it should be fine. Maybe try System.DayOfWeek.

-c

Wednesday, March 7, 2012

Date Format in expression

Hi all,

I would like to generate a file name according to the current date, like 20070716.TXT. In expression, the function Month(Getdate()) will return 7 instead of 07.

How can i do it.

TIA

Patrick

Try this... Going by memory.

RIGHT("00" + (DT_WSTR,50)MONTH([DateColumn])),2)

|||

Start for using this...

=Format(cdate(Fields!Dia.Value),"dd-MM-yyyy")

and concactenate with string you want!!

regards

|||

PedroCGD wrote:

Start for using this...

=Format(cdate(Fields!Dia.Value),"dd-MM-yyyy")

and concactenate with string you want!!

regards

In SSIS? Looks like Excel or something to me.

date format according to regional setting

hi all,

is it possible to format a datetime value in report to display according to the shortdate format set in pc's regional setting ?

i manage to get the parameters to display according to the format in regional setting but is it possible for fields in report to follow shortdate format ?

btw, i can't seem to find the setting for report language under report tab in vs.

i could find language under Tools -> Options -> International Settings -> Language. is it the same thing? cos i've been reading other related posts and seems like the setting can be found under report tab..

Thanks!

Yes, you can specify the format and language style property in the report in order to do that. For detailed information about setting the language property, you can take a look at this page http://msdn2.microsoft.com/en-us/library/ms156493(SQL.90).aspx

|||

hi Fang,

thanks a lot for the swift answer. thanks a lot for pointing me to the url. had been searching high and low through the help file.

i have another problem i.e. i use stored procedure for some of the datasets and the dateformat will cause an error. i know there's a set language function for stored proc but how can i retrieve the pc's regional setting and specify it in the stored proc ?

thanks again!

|||You can pass in User!Language as a query parameter to the stored proc.|||

hi Fang,

i've tried but got this error in RS:

SET LANGUAGE failed because 'en-GB' is not an official language name or a language alias on this SQL Server.

is it the configuration in regional setting?

thanks!