Unable to convert MySQL date/time value to System.DateTime
Posted by: Jonatan Bouillon
Date: July 27, 2017 09:17PM

Since the new release of mysql connector I receive the following error because I have date with format not compatible with .net.

I have the convert zero datetime=true to my connexion string.

server=localhost;userid=xxx;pwd=yyy;port=zzz;database=test;sslmode=none;convert zero datetime=true;allow user variables=true;

I don't understand why the configuration is not working and how I can fix this.

---

MySql.Data.Types.MySqlConversionException

Unable to convert MySQL date/time value to System.DateTime

MySql.Data.Types.MySqlConversionException: Unable to convert MySQL date/time value to System.DateTime
at MySql.Data.Types.MySqlDateTime.GetDateTime()
at MySql.Data.EntityFrameworkCore.Storage.Internal.MySQLDataReader.GetDateTime(Int32 ordinal)
at lambda_method(Closure , DbDataReader )
at Microsoft.EntityFrameworkCore.Storage.Internal.TypedRelationalValueBufferFactory.Create(DbDataReader dataReader)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable.Enumerator.BufferlessMoveNext(Boolean buffer)
at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_ShapedQuery>d__3`1.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__15`2.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at QcRenc.Data.Services.BaseEntityRepository.GetListWithRawSql[TEntity](String query, Object[] parameters) in C:\jbouillon\qcrencontre\src\src\QcRenc.Data\Services\EntityRepository.cs:line 75

Options: ReplyQuote


Subject
Written By
Posted
Unable to convert MySQL date/time value to System.DateTime
July 27, 2017 09:17PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.