Note that there are some explanatory texts on larger screens.

plurals
  1. POOperation is not valid due to the current state of the object
    text
    copied!<p>I'm using Entity Framework with ODP.NET 11.2.0.3.0. I got persistence working for some tables, but this one flat out refuses to add a simple new object and I can't quite figure it out. Your help is greatly appreciated. Thank you</p> <p>Here is the code. I removed the image field from the object through the model browser and still the code fails when SaveChanges() is called. </p> <pre><code>var corpDirectoryEntities = new CorpDirectoryEntities(); var cc = new EmployeePhoto(); cc.UserId = 12345; // NUMBER field cc.ImageName = "imagename"; // VARCHAR2(100) cc.Image = photoStream; // LONG RAW corpDirectoryEntities.EmployeePhotos.AddObject(cc); corpDirectoryEntities.SaveChanges(); </code></pre> <p>The following exception occurs.</p> <pre> System.Data.UpdateException was unhandled by user code Message=An error occurred while updating the entries. See the inner exception for details. Source=System.Data.Entity StackTrace: at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter) at System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache) at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options) at System.Data.Objects.ObjectContext.SaveChanges() at Repositories.Services.CorpDirectory.CorpDirectoryRepository.SaveDirectoryAccountPhoto(Int32 accountId, Byte[] photoStream) in C:\Dev\Projects\Repositories\Services\CorpDirectory\CorpDirectoryRepository.cs:line 356 at Tests.CorpDirectory.CorpDirectoryUserTestFixture.TestGetUserPhoto() in C:\Dev\Projects\Repositories.Tests\CorpDirectory\CorpDirectoryUserTestFixture.cs:line 192 InnerException: System.Data.EntityCommandCompilationException Message=An error occurred while preparing the command definition. See the inner exception for details. Source=System.Data.Entity StackTrace: at System.Data.Mapping.Update.Internal.UpdateTranslator.CreateCommand(DbModificationCommandTree commandTree) at System.Data.Mapping.Update.Internal.DynamicUpdateCommand.CreateCommand(UpdateTranslator translator, Dictionary`2 identifierValues) at System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator translator, EntityConnection connection, Dictionary`2 identifierValues, List`1 generatedValues) at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter) InnerException: System.InvalidOperationException Message=Operation is not valid due to the current state of the object. Source=Oracle.DataAccess StackTrace: at Oracle.DataAccess.Client.SqlGen.DmlSqlGenerator.ExpressionTranslator.Visit(DbScanExpression expression) at System.Data.Common.CommandTrees.DbScanExpression.Accept(DbExpressionVisitor visitor) at Oracle.DataAccess.Client.SqlGen.DmlSqlGenerator.GenerateInsertSql(DbInsertCommandTree tree, EFOracleProviderManifest providerManifest, EFOracleVersion sqlVersion, List`1& parameters) at Oracle.DataAccess.Client.SqlGen.SqlGenerator.GenerateSql(DbCommandTree tree, EFOracleProviderManifest providerManifest, EFOracleVersion sqlVersion, List`1& parameters, CommandType& commandType) at Oracle.DataAccess.Client.EFOracleProviderServices.CreateCommand(EFOracleProviderManifest providerManifest, DbCommandTree commandTree) at Oracle.DataAccess.Client.EFOracleProviderServices.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree) at System.Data.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree commandTree) at System.Data.Common.DbProviderServices.CreateCommand(DbCommandTree commandTree) at System.Data.Mapping.Update.Internal.UpdateTranslator.CreateCommand(DbModificationCommandTree commandTree) InnerException: </pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload