我有一個MVC3應用程序,我從另一個開發人員處收到。我已經建立了正確的數據庫並將其添加到我的Web.config中。有一個叫做位置的模型和控制器。ASP.NET MVC3無效的對象名'Locations_tracking'
的控制器和視圖來添加一個位置是非常標準的CRUD,但是當我嘗試添加一個位置,創建方法拋出這樣的:
Invalid object name 'Locations_tracking'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'Locations_tracking'.
Source Error:
Line 56: location.UpdatedAt = DateTime.Now;
Line 57: db.Locations.Add(location);
Line 58: db.SaveChanges();
Line 59: return RedirectToAction("Index");
Line 60: }
...我已經尋找在我的整個應用程序「跟蹤」並沒有找到任何東西。爲什麼它尋找這個「Locations_tracking」對象,爲什麼它找不到它?我認爲它來自實體框架,因爲我沒有在控制器,模型或視圖中看到任何東西。感謝您的幫助!
就是這樣。這個數據庫已經準備好用於MS Sync Framework,它添加了觸發器和額外的表格。前一個管理員刪除了跟蹤表,但沒有觸發器。謝謝! – 2012-01-18 19:50:20