I have problem retrieving correct date format on client side using MS reporting service 2010.
The British date format (18/05/2011) of date type is assigned to the default value of a parameter in a rdl file hosted on the reproting server. However, when the date value becomes US format (5/18/2011) via reporting service 2010.
ReportingService2010 reportingService = new ReportingService2010();
reportingService.Credentials = CredentialCache.DefaultCredentials;
ItemParameter[] parameters = reportingService.GetItemParameters(reportUrl, historyId, forRendering, values, credentialses);
foreach (var parameter in parameters)
{
//parameter.DefaultValues //date value changed from British value to US
}
Any idea?
I have to create a partial class alongside the generated ReportingService class and override the GetWebRequest method, then add an Accept-Language header to the Web request. Here is a sample class:
public partial class ReportingService
{
protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
WebRequest request = base.GetWebRequest(uri);
request.Headers.Add(HttpRequestHeader.AcceptLanguage, CultureInfo.CurrentCulture.Name);
return request;
}
}
来源:https://stackoverflow.com/questions/8309464/british-date-format-on-reporting-server-turns-to-us-format-on-client-side-via-ms