0
Viva Pessoal,
I’m new to the world. NET, C#, Entityframework (Microsoft world). I am working on a project with the mentioned technologies, initially I was programming on a VM (with Windows) because I use MAC but I had some performance problems and decided to abandon the VM and also because it already exists support for MAC.
I was able to make the settings and the application runs smoothly, except when I have to deal with fields of the type DateTime
, either by persisting at the base or just reading. Below the stacktrace.
Note: I’m using the Sqlserver with Docker
System.Data.SqlClient.SqlException
Conversion failed when converting date and/or time from character string.
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): .Net SqlClient Data Provider.
Exception stack trace:
at System.Data.SqlClient.SqlConnection.ErrorHandler (System.Object sender, Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e) [0x00023] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs:294
at Mono.Data.Tds.Protocol.Tds.OnTdsErrorMessage (Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e) [0x00008] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:1681
at Mono.Data.Tds.Protocol.Tds.ProcessMessage (Mono.Data.Tds.Protocol.TdsPacketSubType subType) [0x000e6] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:1721
at Mono.Data.Tds.Protocol.Tds.ProcessSubPacket () [0x00134] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:1773
at Mono.Data.Tds.Protocol.Tds.NextResult () [0x00039] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:625
at System.Data.SqlClient.SqlDataReader.NextResult () [0x00036] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs:1320
at System.Data.SqlClient.SqlDataReader..ctor (System.Data.SqlClient.SqlCommand command) [0x00019] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs:109
at (wrapper remoting-invoke-with-check) System.Data.SqlClient.SqlDataReader:.ctor (System.Data.SqlClient.SqlCommand)
at System.Data.SqlClient.SqlCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x00068] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:509
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader (System.Data.CommandBehavior behavior) [0x00000] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:764
at System.Data.Common.DbCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x00000] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/external/corefx/src/System.Data.Common/src/System/Data/Common/DbCommand.cs:114
at (wrapper remoting-invoke-with-check) System.Data.Common.DbCommand:ExecuteReader (System.Data.CommandBehavior)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c (System.Data.Common.DbCommand t, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext`1[TResult] c) [0x00007] in <5a182091cae84952ac9bbf3418cefa24>:0
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1[TInterceptor].Dispatch[TTarget,TInterceptionContext,TResult] (TTarget target, System.Func`3[T1,T2,TResult] operation, TInterceptionContext interceptionContext, System.Action`3[T1,T2,T3] executing, System.Action`3[T1,T2,T3] executed) [0x000f1] in <5a182091cae84952ac9bbf3418cefa24>:0
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader (System.Data.Common.DbCommand command, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext interceptionContext) [0x00042] in <5a182091cae84952ac9bbf3418cefa24>:0
at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader (System.Data.CommandBehavior behavior) [0x00046] in <5a182091cae84952ac9bbf3418cefa24>:0
at System.Data.Common.DbCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x00000] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/external/corefx/src/System.Data.Common/src/System/Data/Common/DbCommand.cs:114
at (wrapper remoting-invoke-with-check) System.Data.Common.DbCommand:ExecuteReader (System.Data.CommandBehavior)
at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute (System.Collections.Generic.Dictionary`2[TKey,TValue] identifierValues, System.Collections.Generic.List`1[T] generatedValues) [0x0007e] in <5a182091cae84952ac9bbf3418cefa24>:0
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update () [0x0002b] in <5a182091cae84952ac9bbf3418cefa24>:0
And where is the code that caused the error?
– Leandro Angelo
This looks like a SQL date conversion error. Very common pq your computer should use a "human" standard type "31/12/1982" while SQL probably expects something like ISO "1982-12-31"
– jean
@jean how do I change this? I’ve tried to change the date format using the MAC GUI but it doesn’t seem to work. Leandroangelo, I did not find it relevant to put the code because it happens with any operation of reading or persistence of dates and as I said in Windows works normally
– Eudson
Depends on your code. But if it works on one machine and not another check the date pattern on both and how the language was set in SQL server (if not all on the same server)
– jean
@jean, is that the problem is that ñ can make this change, at least using the UI of the OS, I believe it should be done on the command line, already researched everything and nothing.
– Eudson
set language, set dateformat search for MSDN and switch to SQL Server
– jean