Print Page | Close Window

Updatable View

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2471
Printed Date: 16-Jul-2026 at 12:40pm


Topic: Updatable View
Posted By: gregweb
Subject: Updatable View
Date Posted: 28-Jan-2011 at 10:54am
I am getting the following error message when I try to udate an Entity.  The entity is created from a View, and the back end is MySql.  The view is a very simple view, based off one table.  It just has fewer fields than the base table, and it has a whereclause to limit the items (where IsDeleted = fasle).  The view is updatable per the MySql rules.
 
 
Entity Save Error: System.Data.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> MySql.Data.MySqlClient.MySqlException: Every derived table must have its own alias at MySql.Data.MySqlClient.MySqlStream.ReadPacket() at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId) at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int32& insertedId) at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId) at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader() at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() at MySql.Data.Entity.EFMySqlCommand.ExecuteNonQuery() 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) --- End of inner exception stack trace --- 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 IdeaBlade.EntityModel.Edm.EdmSaveExecutor.ProcessSaves(IEnumerable`1 groupsByType) at IdeaBlade.EntityModel.Edm.EdmSaveExecutor.SaveWithinContext() at IdeaBlade.EntityModel.Edm.EdmSaveExecutor.Save(DataSourceResolver dataSourceResolver, IDataSourceKey dsKey, SaveWorkState workState)
 
Thanks,
 
Greg



Replies:
Posted By: DenisK
Date Posted: 28-Jan-2011 at 12:54pm
Hi Greg;

It sounds like you're missing an alias somewhere in your SQL statement when building the view. You can read the following links to see the various ways you can miss an alias.

http://stackoverflow.com/questions/1888779/every-derived-table-must-have-its-own-alias - http://stackoverflow.com/questions/1888779/every-derived-table-must-have-its-own-alias

http://www.codeguru.com/forum/showthread.php?t=420682 - http://www.codeguru.com/forum/showthread.php?t=420682

http://bytes.com/topic/mysql/answers/877061-error-every-derived-table-must-have-its-own-alias - http://bytes.com/topic/mysql/answers/877061-error-every-derived-table-must-have-its-own-alias

A Google search using the following keyword "Every derived table must have its own alias" also yields many results.

Hope this helps.



Print Page | Close Window