SQL Server Reporting Services 报告中的日期格式(区域设置)错误

发布于 2024-12-27 07:12:29 字数 1587 浏览 1 评论 0原文

我无法通过 SSRS 报告解决问题。

该场景是:Silverlight 应用程序中的链接加载一个包含 Microsoft.Reporting.WebForms.ReportViewer 控件的新网页。控件的参数在 QueryString 中传递到新页面。

如果传递的日期为 01/08/2011,则加载报表时,报表查看器上的日期控件的值为 08/01/2011(即它已转换为美国格式,我的区域设置为英国,en -GB)。

这仅发生在已部署的解决方案中,它在我本地 PC 上的 Visual Studio 中正常工作。我的IE设置是正确的。

我对已部署的 IIS 服务器 (IIS 6.0) 进行了以下检查:-

相关应用程序池的安全帐户 = 网络服务。

在注册表中,该用户的 SID 是 S-1-5-20,因此我检查了 HKEY_USERS > 下的注册表设置: S-1-5-20>控制面板>国际的 。这些都是针对英国正确设置的。虽然理论上它们不应该产生影响,但我还检查了本地系统 (S-1-5-18) 和 NT 权限 (S-1-5-19) 的相同设置,它们是相同的。

接下来我检查了网站上的文化和 UI 文化。这些如下: -

右键单击​​网站 - 属性> ASP.NET。 单击“编辑全局配置”按钮检查服务器配置设置。 选择“应用程序”选项卡并查看“文化”和“UI 文化”的值。

两个值均设置为 en-GB。那么好吧。

在“编辑配置”按钮中执行相同操作,用于查看/编辑特定应用程序的配置文件。网站的配置文件值将取代服务器配置文件值。这些也都可以。

接下来我检查了 SSRS 服务器。

服务在“本地系统”帐户下运行。 此帐户的注册表设置正确 HKEY_USERS > S-1-5-18>控制面板>国际的。 S-1-5-19 和 S-1-5-20 还正确的

ReportServer.aspx 页面指令包括 Culture="en-GB" (例如 <%@ Page Language="C#" AutoEventWireup="true" Inherits="Microsoft.ReportingServices.WebServer.ReportViewerPage" Culture="en-GB"%>)

在代码中,参数值使用 Microsoft.Reporting 设置.WebForms.ReportViewer.SetParameters(ms.ReportParameter []) 和 ms.ReportParameter(name, value,visible) 以及此时收到的参数绝对是正确的值Web 应用程序(当我单步执行代码时)。

我不知道下一步该转向哪里。我有一个区别,但我无法想象问题是查询字符串在部署的版本上进行了 URLEncoded,但在我的本地 PC 上的设计中没有,即

[服务器版本] ...%26END_DATE%3d31%2f07%2f2012+00%3a00%3a00%26START_DATE%3d01%2f08%2f2011+00%3a00%3a00

[本地版本]

...&END_DATE=31/07/2012+00:00:00&START_DATE=01/08/2011+00:00:00

对于任何人提出的任何建议,我将非常感激。

I am unable to solve an issue with a report on SSRS.

The scenario is : a link in a Silverlight application loads a new web page containing a Microsoft.Reporting.WebForms.ReportViewer control. The parameters for the control are passed in the QueryString to the new page.

If the date is passed as 01/08/2011, when the report is loaded, the date control on the report viewer has the value 08/01/2011 (i.e. it has been converted to American format and my locale is United Kingdom, en-GB).

This only happens in the deployed solution, it works correctly in Visual Studio on my local PC. My IE settings are correct.

I made the following checks on the deployed IIS Server (IIS 6.0):-

The security account for the relevant Application Pool = Network Service.

In the Registry the SID for this user is S-1-5-20 so I checked the registry settings under HKEY_USERS > S-1-5-20 > Control Panel > International . These were all correctly set for United Kingdom. Although theoretically they should not have an effect I also checked the same settings for Local System (S-1-5-18) and NT-Authority (S-1-5-19) which were identical.

I next checked the Culture and UI Culture on the web site. These were as follows: -

Right-click website - Properties > ASP.NET.
Click the 'Edit Global Configuration' button to check the server config settings.
Select the Application tab and view the values for Culture and UI Culture.

Both values are set as en-GB. So OK.

Did the same in the 'Edit Configuration' button which is for viewing/editing the specific application's config file.The websites' config file values will supercede the server config file values. These are also OK.

Next I checked the SSRS Server.

Service runs under 'Local System' account.
Registry settings for this account are correct HKEY_USERS > S-1-5-18 > Control Panel > International.
S-1-5-19 and S-1-5-20 also correct

ReportServer.aspx page directive includes Culture="en-GB"
(e.g. <%@ Page Language="C#" AutoEventWireup="true" Inherits="Microsoft.ReportingServices.WebServer.ReportViewerPage" Culture="en-GB"%>)

In code the parameter values are set using Microsoft.Reporting.WebForms.ReportViewer.SetParameters(ms.ReportParameter []) and ms.ReportParameter(name, value, visible) and the parameters are definitely the correct value when they are received at this point by the web app (when I step through in code).

I don't know where to turn next. The one difference I have but I can't imagine it is the problem is that the querystring is URLEncoded on the deployed version but not in the design on my local PC i.e

[server version]
...%26END_DATE%3d31%2f07%2f2012+00%3a00%3a00%26START_DATE%3d01%2f08%2f2011+00%3a00%3a00

[local version]

...&END_DATE=31/07/2012+00:00:00&START_DATE=01/08/2011+00:00:00

I would be extremely GRATEFUL for any suggestions that anyone has.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

面犯桃花 2025-01-03 07:12:29

如果您以 dd-mmm-yyyy 格式传递日期,那么它是明确的,例如 18-Jan-2011。

If you pass in the date in dd-mmm-yyyy format then it is unabiguous, eg 18-Jan-2011.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文