Entity Framework and Linq generates different SQL for different tables in MySql

DonaldC

New Member
I'm using the Entity Framework in order to update two tables in my MySql database.One of the tables is updated just fine but the other one returns an error:\[code\]Every derived table must have its own alias.\[/code\]I traced the SQL code for both. The Entity Framework generates standard SQL UPDATE query for the first table (which works). The second table gets this code:\[code\]UPDATE (SELECT `copies`.`id`, `copies`.`parent`, `copies`.`region`, `copies`.`loaner`, `copies`.`owner` FROM `copies` AS `copies`) SET `parent`=40, `region`=1, `loaner`=32, `owner`=19 WHERE `id` = 104\[/code\]Which returns the "derived table" error.The code for updating both tables (with different names obviously) is as follows:\[code\]db.tablename.Attach(objectname);db.ObjectStateManager.ChangeObjectState(objectname, EntityState.Modified);db.SaveChanges();\[/code\]Why don't the second table get a standard SQL UPDATE query like the first table?
 
Back
Top