0
嘿,我在使用域服務,實體框架和asp.net更新記錄時遇到問題。Me.ChangeSet.GetOriginal,未將對象引用設置爲對象的實例
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 257: }
Line 258: Me.ObjectContext.OrderStatusHistories.AddObject(_orderStatusHistory)
Line 259: Me.ObjectContext.Orders.AttachAsModified(currentOrder, Me.ChangeSet.GetOriginal(currentOrder))
Line 260: End Sub
Line 261:
該命令是在數據庫中提交的,有誰知道這是怎麼回事?
很明顯,其中一個對象有一個空引用,你試過調試嗎? – RPM1984 2010-12-16 10:18:55
你必須顯示更多的代碼。在哪一行發生錯誤。錯誤狀態表明您嘗試訪問的某個對象未設置(Nothing)。你可以用調試器來檢查。 – Jan 2010-12-16 10:20:19