I wonder if you can help me: I've recently had to upgrade my clubsite from an ASP.NET 2 Beta 2 server to a ASP.NET 2 server and I'm getting datetime problems. I am in the UK and the host server is in the states, but it all used to work before the upgrade.
I've recompiled everything using Visual Studio 2005 RTM.
Line 256 in EventCalendar.cs is giving me problems
Where RHS of the code line above would be e.g. "starttime>= #31/10/2005# AND starttime < #01/11/2005#"
N.B. I had to put in the .ToString("dd/MM/yyyy") to get at UK dates. Also I am using a SQL Server 2000 database.
Used to work before the upgrade but now gives error below:
Anyone any clues on what I need to do to get this working again?
Thanks in advance,
Tony
String was not recognized as a valid DateTime.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: String was not recognized as a valid DateTime.
Source Error:
Line 256: dv.RowFilter = string.Format("{0}>= #{1}# AND {0} < #{2}#", this.DayField, d.ToString("dd/MM/yyyy"), d.AddDays(1).ToString("dd/MM/yyyy"));
Source File: C:\Documents and Settings\xxxxx\My Documents\Visual Studio 2005\WebSites\Club Web Site Starter Kit1\EventCalendar\EventCalendar.cs Line: 256
Stack Trace:
[FormatException: String was not recognized as a valid DateTime.]
System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +2272290
System.DateTime.Parse(String s, IFormatProvider provider) +26
System.Data.ConstNode..ctor(DataTable table, ValueType type, Object constant, Boolean fParseQuotes) +490
System.Data.ConstNode..ctor(DataTable table, ValueType type, Object constant) +39
System.Data.ExpressionParser.Parse() +1616
System.Data.DataExpression..ctor(DataTable table, String expression, Type type) +154
System.Data.DataExpression..ctor(DataTable table, String expression) +35
System.Data.DataView.set_RowFilter(String value) +192
ControlSample.EventCalendar.CreateDataBoundChildren(DataView dv, Table table, DateTime todaysDate, DateTime visibleDate, Calendar threadCalendar) in C:\Documents and Settings\jbushell\My Documents\Visual Studio 2005\WebSites\Club Web Site Starter Kit1\EventCalendar\EventCalendar.cs:256
ControlSample.EventCalendar.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) in C:\Documents and Settings\jbushell\My Documents\Visual Studio 2005\WebSites\Club Web Site Starter Kit1\EventCalendar\EventCalendar.cs:223
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +89
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +126
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +98
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +154
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +99
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +91
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +101
System.Web.UI.Control.EnsureChildControls() +134
System.Web.UI.Control.PreRenderRecursiveInternal() +109
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4437
The rowfiler has issues with different date formats, and the current locale context for the thread and machine. I updated the code for RTM to use a fixed locale for the row filter and date comparison (US format) but the actual display of dates will pickup the
locale settings for the app. You should be able to make the app "UK" locale by setting the culture in the globalization section of config to "en-uk".
Tony B
Member
35 Points
7 Posts
Datetime problem with EventCalendar.dll since upgrading from Beta 2 to RTM
Nov 15, 2005 12:54 AM|LINK
Hi,
I wonder if you can help me: I've recently had to upgrade my clubsite from an ASP.NET 2 Beta 2 server to a ASP.NET 2 server and I'm getting datetime problems. I am in the UK and the host server is in the states, but it all used to work before the upgrade. I've recompiled everything using Visual Studio 2005 RTM.
Line 256 in EventCalendar.cs is giving me problems
dv.RowFilter = string.Format("{0}>= #{1}# AND {0} < #{2}#", this.DayField, d.ToString("dd/MM/yyyy"), d.AddDays(1).ToString("dd/MM/yyyy"));
Where RHS of the code line above would be e.g. "starttime>= #31/10/2005# AND starttime < #01/11/2005#"
N.B. I had to put in the .ToString("dd/MM/yyyy") to get at UK dates. Also I am using a SQL Server 2000 database.
Used to work before the upgrade but now gives error below:
Anyone any clues on what I need to do to get this working again?
Thanks in advance,
Tony
String was not recognized as a valid DateTime.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: String was not recognized as a valid DateTime.
Source Error:
Line 256: dv.RowFilter = string.Format("{0}>= #{1}# AND {0} < #{2}#", this.DayField, d.ToString("dd/MM/yyyy"), d.AddDays(1).ToString("dd/MM/yyyy"));
Source File: C:\Documents and Settings\xxxxx\My Documents\Visual Studio 2005\WebSites\Club Web Site Starter Kit1\EventCalendar\EventCalendar.cs Line: 256
Stack Trace:
[FormatException: String was not recognized as a valid DateTime.]
System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +2272290
System.DateTime.Parse(String s, IFormatProvider provider) +26
System.Data.ConstNode..ctor(DataTable table, ValueType type, Object constant, Boolean fParseQuotes) +490
System.Data.ConstNode..ctor(DataTable table, ValueType type, Object constant) +39
System.Data.ExpressionParser.Parse() +1616
System.Data.DataExpression..ctor(DataTable table, String expression, Type type) +154
System.Data.DataExpression..ctor(DataTable table, String expression) +35
System.Data.DataView.set_RowFilter(String value) +192
ControlSample.EventCalendar.CreateDataBoundChildren(DataView dv, Table table, DateTime todaysDate, DateTime visibleDate, Calendar threadCalendar) in C:\Documents and Settings\jbushell\My Documents\Visual Studio 2005\WebSites\Club Web Site Starter Kit1\EventCalendar\EventCalendar.cs:256
ControlSample.EventCalendar.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) in C:\Documents and Settings\jbushell\My Documents\Visual Studio 2005\WebSites\Club Web Site Starter Kit1\EventCalendar\EventCalendar.cs:223
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +89
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +126
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +98
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +154
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +99
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +91
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +101
System.Web.UI.Control.EnsureChildControls() +134
System.Web.UI.Control.PreRenderRecursiveInternal() +109
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4437
samsp
Participant
1680 Points
330 Posts
Microsoft
Re: Datetime problem with EventCalendar.dll since upgrading from Beta 2 to RTM
Nov 17, 2005 01:12 AM|LINK
Sam
Tony B
Member
35 Points
7 Posts
Re: Datetime problem with EventCalendar.dll since upgrading from Beta 2 to RTM
Nov 17, 2005 04:43 PM|LINK
Thanks Sam,
I figured there was a problem here as I too just forced rowfiler to be given US format dates and have my Web.config set locale to "en-uk".
Tony