Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# SSRS日期时间参数默认值格式_C#_Asp.net_Datetime_Reporting Services - Fatal编程技术网

C# SSRS日期时间参数默认值格式

C# SSRS日期时间参数默认值格式,c#,asp.net,datetime,reporting-services,C#,Asp.net,Datetime,Reporting Services,我有一个asp.net应用程序,允许用户为SSRS报告创建订阅 我的所有报告都有@StartDate和@EndDate参数,其默认值为 =Today.AddDays(-14) 及 分别 我的c代码在加载订阅表单时检查参数的默认值,以预填充AspxDateEdit控件。这一切都可以在我的开发环境(新西兰)上正常工作 最初的网站将驻留在澳大利亚的服务器上,随后将向世界各地的各个国家推出,因此我需要保持DateTimes的格式动态(特定于文化) 在实时系统上加载报表的订阅表单时,我收到错误“字符串

我有一个asp.net应用程序,允许用户为SSRS报告创建订阅

我的所有报告都有@StartDate和@EndDate参数,其默认值为

=Today.AddDays(-14) 

分别

我的c代码在加载订阅表单时检查参数的默认值,以预填充AspxDateEdit控件。这一切都可以在我的开发环境(新西兰)上正常工作

最初的网站将驻留在澳大利亚的服务器上,随后将向世界各地的各个国家推出,因此我需要保持DateTimes的格式动态(特定于文化)

在实时系统上加载报表的订阅表单时,我收到错误“字符串未被识别为有效的日期时间”。转储参数值。DefaultValues[0]显示AU服务器上的默认值为US格式(MM/dd/yyyy),这导致了错误。日志代码:

SQLReportsLogic.Log(MyLog, "(Line 599 - LoadParams)Default Param Value:" + Rp.DefaultValues[0] + "/ ServerDateFormatToday:" + DateTime.Now);
结果输出:

(Line 599 - LoadParams)Default Param Value:3/24/2015 12:00:00 AM/ ServerDateFormatToday:24/03/2015 7:14:47 AM
格式应与服务器的区域性信息一致,即dd/MM/yyyy

-   The report language is set to User!Language
-   The Server System Locale is English(Australia)
-   The Server Location is Australia
-   The Server Datetime format is set to ShortDate=d/MM/yyyy LongDate=dddd, d MMMM yyyy
-   The Server Language is set to English (Australia)
-   The Reporting Services Service is running under Local System Account
-   WWW is running under Local System Account
-   SSRS is running in Native Mode
当确定=Today()的格式时,SSR具体从何处获取日期时间格式?据我了解,到目前为止,这应该是以系统指定的dd/MM/yyyy格式生成的=Today() 我还尝试将参数的DefaultValue格式化为

-   “yyyy/MM/dd hh:mm:ss” = The DefaultValue expression for the report parameter ‘StartDate’ contains an error: Input string was not in a correct format
-   “yyyy/MM/dd hh:mm” = The DefaultValue expression for the report parameter ‘StartDate’ contains an error: Input string was not in a correct format
-   “yyyy/MM/dd” = The DefaultValue expression for the report parameter ‘StartDate’ contains an error: Input string was not in a correct format
-   DateFormat.ShortDate = The property ‘DefaultValue’ of report parameter ‘StartDate’ doesn’t have the expected type.
-   DateFormat.LongDate = The property ‘DefaultValue’ of report parameter ‘StartDate’ doesn’t have the expected type.
-   DateFormat.GeneralDate = The property ‘DefaultValue’ of report parameter ‘StartDate’ doesn’t have the expected type.
除非我能解决SSRS呈现=Today()的方式,否则我的手似乎被束缚住了。据我所知,我需要找出SSRS安装使用不正确区域性的问题?它在什么地方查过了吗


我正在使用VS2012(11.0.61030.00更新4)和SSDTBI插件(MSSQL Server Reporting Services Designers版本11.0.3436.0)

最终找到了要使用的正确搜索词,并在两天后找到了解决方案-如本文所述覆盖SSRS GetWebRequest。。

公共部分类ReportingService:DevReportService.ReportingService 2010
{
/// 
///获取或设置生成报表时使用的区域性。
/// 
///生成报告时使用的区域性。
公共文化信息文化{get;set;}
受保护的覆盖WebRequest GetWebRequest(Uri)
{
WebRequest=base.GetWebRequest(uri);
CultureInfo culture=this.culture??CultureInfo.CurrentCulture;
request.Headers.Add(HttpRequestHeader.AcceptLanguage,culture.Name);
返回请求;
}
}

我们能看到抛出此
格式异常的代码吗?您的文化设置是什么?谢谢Soner,我已经在问题中添加了代码,我的文化在web中设置为中性。很好的答案!对此的一个增强是创建一个新类,该类将DevReportService.ReportingService2010作为父类,以防将来重新生成WSDL CS文件
-   The report language is set to User!Language
-   The Server System Locale is English(Australia)
-   The Server Location is Australia
-   The Server Datetime format is set to ShortDate=d/MM/yyyy LongDate=dddd, d MMMM yyyy
-   The Server Language is set to English (Australia)
-   The Reporting Services Service is running under Local System Account
-   WWW is running under Local System Account
-   SSRS is running in Native Mode
-   “yyyy/MM/dd hh:mm:ss” = The DefaultValue expression for the report parameter ‘StartDate’ contains an error: Input string was not in a correct format
-   “yyyy/MM/dd hh:mm” = The DefaultValue expression for the report parameter ‘StartDate’ contains an error: Input string was not in a correct format
-   “yyyy/MM/dd” = The DefaultValue expression for the report parameter ‘StartDate’ contains an error: Input string was not in a correct format
-   DateFormat.ShortDate = The property ‘DefaultValue’ of report parameter ‘StartDate’ doesn’t have the expected type.
-   DateFormat.LongDate = The property ‘DefaultValue’ of report parameter ‘StartDate’ doesn’t have the expected type.
-   DateFormat.GeneralDate = The property ‘DefaultValue’ of report parameter ‘StartDate’ doesn’t have the expected type.
public partial class ReportingService : DevReportService.ReportingService2010
{

    /// <summary>

    /// Gets or sets the culture that is used when generating the report.

    /// </summary>

    /// <value>The culture that is used when generating the report.</value>

    public CultureInfo Culture { get; set; }

    protected override WebRequest GetWebRequest(Uri uri)
    {

        WebRequest request = base.GetWebRequest(uri);

        CultureInfo culture = this.Culture ?? CultureInfo.CurrentCulture;

        request.Headers.Add(HttpRequestHeader.AcceptLanguage, culture.Name);

        return request;

    }

}