List:MySQL and .NET« Previous MessageNext Message »
From:Reggie Burnett Date:March 10 2005 8:41pm
Subject:RE: Dates > 9997-10-29 can't be read.
View as plain text  
I just committed a fix for this.  It was the same problem as in
Bug #8929  	Timestamp values with a date > 10/29/9997 cause problems

-reggie 

> -----Original Message-----
> From: Clif Cable [mailto:clif@stripped] 
> Sent: Thursday, March 10, 2005 2:24 PM
> To: 'Kevin Turner'; dotnet@stripped
> Subject: RE: Dates > 9997-10-29 can't be read.
> 
> Yes and No. The Application I work on is large and has been 
> around for about 20 years. The newer parts are written using 
> Visual Studio 2003 in VB. Some of the parts are written in 
> VB6 and before that is Microfocus COBOL.
> 
> We still have over 1000 COBOL programs that do a lot of the 
> Batch processing. I also have about 50 VB6 Dll's that do a 
> lot of the user interface and are the interface between the 
> COBOL and the Data. I would like to be rid of all the old 
> code but with as much as we have it is going to take a long time.
> 
> I am hoping that this will get fixed in the future and I will 
> just have to wait until it is. 
> 
> -----Original Message-----
> From: Kevin Turner [mailto:kevin.turner@stripped]
> Sent: Thursday, March 10, 2005 2:10 PM
> To: dotnet@stripped
> Subject: FW: Dates > 9997-10-29 can't be read.
> 
> When this started happening to me I reverted to using 
> 3000-12-31 on the basis that if anyone is still using my 
> software at that point in the future they deserve all they 
> get.  It wasn't a pain to implement - just a mass scan and 
> replace in Visual Studio.  Is that what you are using ?
> 
> -----Original Message-----
> From: Clif Cable [mailto:clif@stripped]
> Sent: 10 March 2005 19:35
> To: dotnet@stripped
> Subject: Dates > 9997-10-29 can't be read.
> 
> I use Date columns with the Max value allowed to indicate 
> forever. Using version 1.0.2 these work just fine. I am 
> trying to move to the newest version 1.0.4 but if I try to 
> read a row that has a date column with any value greater than 
> 9997-10-29 I get an error when I read it.
> 
> This is the error I get using MySQL 4.1.10 and Connector 1.0.4
> 
> Unhandled Exception: System.ArgumentOutOfRangeException: 
> Ticks must be between DateTime.MinValue.Ticks and 
> DateTime.MaxValue.Ticks.
> Parameter name: ticks
>    at System.DateTime..ctor(Int64 ticks)
>    at System.DateTime.Add(Double value, Int32 scale)
>    at System.DateTime.AddDays(Double value)
>    at MySql.Data.Types.MySqlDateTime..ctor(Int32 year, Int32 
> month, Int32 day, Int32 hour, Int32 minute, Int32 second, 
> MySqlDbType type)
>    at MySql.Data.Types.MySqlDateTime.ParseMySql(String s, 
> Boolean is41)
>    at MySql.Data.Types.MySqlDateTime.ReadValue(PacketReader 
> reader, Int64
> length)
>    at 
> MySql.Data.MySqlClient.NativeDriver.ReadFieldValue(Int32 
> index, MySqlField field, MySqlValue valObject)
>    at 
> MySql.Data.MySqlClient.CommandResult.ReadDataRow(Boolean loadFields)
>    at MySql.Data.MySqlClient.MySqlDataReader.Read()
>    at TestConsole.Module1.main() in
> C:\Camelot\w12\TestConsole\Module1.vb:line 21
> 
> I can create this condition with the following VB.Net code. 
> The Error comes when I try to read the third row that 
> contains the value 9997-10-30
> 
>         Dim Con As New
> MySql.Data.MySqlClient.MySqlConnection("Server=localhost;datab
> ase=Test")
>         Con.Open()
>         Dim Cmd As New MySql.Data.MySqlClient.MySqlCommand
>         Cmd.Connection = Con
>         Cmd.CommandText = "DROP TABLE IF EXISTS Clif"
>         Cmd.ExecuteNonQuery()
>         Cmd.CommandText = "CREATE TABLE Clif (MyDate DATE NOT 
> NULL DEFAULT '0100-01-01')"
>         Cmd.ExecuteNonQuery()
>         Cmd.CommandText = "INSERT INTO Clif (MyDate) VALUES (?MyDate)"
>         Cmd.Parameters.Add("MyDate",
> MySql.Data.MySqlClient.MySqlDbType.Date)
>         Cmd.Parameters("MyDate").Value = Date.MinValue
>         Cmd.ExecuteNonQuery()
>         Cmd.Parameters("MyDate").Value = Date.Parse("9997-10-29")
>         Cmd.ExecuteNonQuery()
>         Cmd.Parameters("MyDate").Value = Date.Parse("9997-10-30")
>         Cmd.ExecuteNonQuery()
>         Cmd.CommandText = "SELECT * FROM Clif ORDER BY MyDate"
>         Dim Rd As MySql.Data.MySqlClient.MySqlDataReader = 
> Cmd.ExecuteReader
>         Do Until Not Rd.Read
>             Console.WriteLine(Rd.GetDateTime(0))
>         Loop
>         Rd.Close()
>         Con.Close()
> 
> I could change my database to use a smaller value for the 
> forever dates but would not like to as it would mean changing 
> all my code that know about 9999-12-31.
> 
> Am I doing something wrong or is the connector broken?
> 
> 
> 
> 
> --
> MySQL on .NET Mailing List
> For list archives: http://lists.mysql.com/dotnet To unsubscribe:
> http://lists.mysql.com/dotnet?unsub=1
> 
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.7.1 - Release Date: 09/03/2005
>  
> 
> -- 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.7.1 - Release Date: 09/03/2005
>  
> 
> "NOTICE: The information in this electronic mail transmission 
> is intended by
> CoralTree Systems Ltd for the use of the named individuals or 
> entity to
> which it is directed and may contain information that is privileged or
> otherwise confidential. If you have received this electronic mail
> transmission in error, please delete it from your system 
> without copying or
> forwarding it, and notify the sender of the error by reply email or by
> telephone, so that the sender's address records can be corrected."
> 
> 
> -- 
> MySQL on .NET Mailing List
> For list archives: http://lists.mysql.com/dotnet
> To unsubscribe:
> http://lists.mysql.com/dotnet?unsub=1
> 
> 
> 
> 
> -- 
> MySQL on .NET Mailing List
> For list archives: http://lists.mysql.com/dotnet
> To unsubscribe:    
> http://lists.mysql.com/dotnet?unsub=1
> 

Thread
FW: Dates > 9997-10-29 can't be read.Kevin Turner10 Mar
  • RE: Dates > 9997-10-29 can't be read.Clif Cable10 Mar
    • RE: Dates > 9997-10-29 can't be read.Reggie Burnett10 Mar