Skocz do zawartości

System.Data.Entity.Core.UpdateException:Cannot insert duplicate key in object 'ModelDanychContainer.ExtensionEntities'

Polecane posty

Witam

Mam problem z aktualizacją bazy danych


Poniżej wycienek log z programu i załączony pełny log

System.Data.Entity.Core.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_ExtensionEntities'. Cannot insert duplicate key in object 'ModelDanychContainer.ExtensionEntities'. The duplicate key value is (-98).
The statement has been terminated.
   w System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   w System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   w System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   w System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   w System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   w System.Data.SqlClient.SqlDataReader.get_MetaData()
   w System.Data.SqlClient.SqlCommand.FinishExecuteReader(SNexo_001 Kancelaria Biegłych Rewidentów Aleksandra Kukla 202404110925.txtqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   w System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   w System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   w System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   w System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   w System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   w System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
   w System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<>c.<Reader>b__6_0(DbCommand t, DbCommandInterceptionContext`1 c)
   w System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
   w System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
   w System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
   w System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
   w System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(Dictionary`2 identifierValues, List`1 generatedValues)
   w System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
   --- Koniec śladu stosu wyjątków wewnętrznych ---
   w System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
   w System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.<>c.<Update>b__21_0(UpdateTranslator ut)
   w System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[T](T noChangesResult, Func`2 updateFunction)
   w System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update()
   w System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesToStore>b__153_0()
   w System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
   w System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
   w System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass148_0.<SaveChangesInternal>b__0()
   w System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
   w System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
   w System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options)
   w InsERT.Mox.DatabaseManagement.EFDataInstaller.SaveChangesCore(ObjectContext ctx, DbConnection alterTableConnection)
   w InsERT.Mox.DatabaseManagement.EFDataInstaller.Update(EFData data, EFDataManifest previousVersionManifest, String updateTag)
   w InsERT.Mox.DatabaseManagement.DatabaseManager.UpdateDefaultDataPackage(InstallationPlan plan, String updateTag, Byte[] updateData, Assembly modelAssembly, EFData data)
   w InsERT.Mox.DatabaseManagement.DatabaseManager.GetUpdateData(InstallationPlan plan, String artifactIdentity, String updateTag, Byte[] updateData)
   w InsERT.Mox.DatabaseManagement.DatabaseManager.UpdateArtifact(InstallationPlan plan, String artifactIdentity)
   w InsERT.Mox.DatabaseManagement.DatabaseManager.InstallOrUpdateArtifact(InstallationPlan plan, String artifactIdentity)
   w InsERT.Mox.DatabaseManagement.DatabaseManager.Install(DatabaseManifest manifest, Boolean asSingleUser)

 

POLISCH CI_AS JEST NA BAZIE DANYCH

 

image.png.c42ed7755ef7e5eac1cbaff079a73041.png

image.png.e85b25014d9fd501b96d3a4e93b5407d.pngextension.xlsx

Konserwacja bazy danych była robiona image.png.59c618c2496236592966e32cd9190561.png

Przeglądałem tabele ręcznie i nie widzę dubli

image.thumb.png.1e2b86558517db2c29ff4d1ee1814125.png

Link to postu

Dzień dobry,

z przesłanych informacji wynika, że wystąpił błąd przy konwersji bazy danych. Co więcej, jest to już druga próba konwersji, z których obie zakończyły się niepowodzeniem. W takim wypadku należy przywrócić kopię bazy danych sprzed tych konwersji i na tak przywróconym podmiocie spróbować ponownie zaktualizować bazę danych.

Link to postu
×
×
  • Dodaj nową pozycję...