One of our developper have a problem occuring when inserting a new entity. The following error is raised by sqlserver:
"Msg 8114, Level 16, State 5, Line 0
Erreur de conversion du type de données varchar en datetime."
LLBLGenPro 2.5 (September 24th, 2007)
SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll: 2.5.7.831
We use adapter version on .Net 2.0
We use the preset SD.Presets.Adapter.General2005
The generated SQL is as follow when it works :
(Note 1: the only difference when it does not work is the datetime format '1989-10-21 00:00:00:000'
Note 2: both formats work on my computer)
"declare @p3 int
set @p3=124
exec sp_executesql N'INSERT INTO [Fv2].[directory].[Individual] ([LastName], [FirstName]) VALUES (@LastName, @FirstName);SELECT @Id=SCOPE_IDENTITY()',N'@Id int output,@LastName nvarchar(50),@FirstName nvarchar(50)',@Id=@p3 output,@LastName=N'kayak',@FirstName=N'Roll'
select @p3
exec sp_executesql N'INSERT INTO [Fv2].[ccomembers].[Cadet] ([IndividualId], [GenderId], [CorrespondanceLanguageId], [Birthdate], [JoinReasonId], [HasNoHealthInsurance], [HasCourtDecree], [CommandingOfficerCertificationDate], [CadetCorpsId], [ModificationDate], [ModificationUser], [CreationDate], [CreationUser]) VALUES (@IndividualId, @GenderId, @CorrespondanceLanguageId, @Birthdate, @JoinReasonId, @HasNoHealthInsurance, @HasCourtDecree, @CommandingOfficerCertificationDate, @CadetCorpsId, @ModificationDate, @ModificationUser, @CreationDate, @CreationUser)',N'@IndividualId int,@GenderId int,@CorrespondanceLanguageId int,@Birthdate datetime,@JoinReasonId int,@HasNoHealthInsurance bit,@HasCourtDecree bit,@CommandingOfficerCertificationDate datetime,@CadetCorpsId int,@ModificationDate datetime,@ModificationUser nvarchar(50),@CreationDate datetime,@CreationUser nvarchar(50)',@IndividualId=124,@GenderId=1,@CorrespondanceLanguageId=1,@Birthdate='Oct 21 1989 12:00:00:000AM',@JoinReasonId=1,@HasNoHealthInsurance=1,@HasCourtDecree=0,@CommandingOfficerCertificationDate='Aug 20 2008 12:00:00:000AM',@CadetCorpsId=17,@ModificationDate='Oct 20 2008 11:22:51:460AM',@ModificationUser=N'',@CreationDate='Oct 20 2008 11:22:51:460AM',@CreationUser=N''
"
Stack trace:
System.Data.SqlClient.SqlException: La conversion d'un type de données CHAR en type DATETIME a donné une valeur hors limite de date et d'heure.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.HasMoreRows()
at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout)
at System.Data.SqlClient.SqlDataReader.Read()
at System.Data.SqlClient.SqlCommand.CompleteExecuteScalar(SqlDataReader ds, Boolean returnSqlValue)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.ExecuteScalar()
SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException: An exception was caught during the execution of a retrieval query: La conversion d'un type de données CHAR en type DATETIME a donné une valeur hors limite de date et d'heure.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.
at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.ExecuteScalar()
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteScalarQuery(IRetrievalQuery queryToExecute)
at CCO.Fortress.Services.Cadet.CadetServiceTest.GetStatusIdAtSpecificDate(Int32 cadetId, DateTime specificDate, Int32 cadetCorpsId, Int32 maxCadetAge) in CadetServiceTest.cs:line 682
at CCO.Fortress.Services.Cadet.CadetServiceTest.TestVerifyStatusAtExcusedAbsenceEndDate() in CadetServiceTest.cs:line 750
Is there some configuration to check?
Thanks,
Hugues