且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用EntityDataSource更新DetailsView时出现问题

更新时间:2022-12-07 15:04:17

没有人能指出我一个解决方案,我找不到任何关于此错误的参考! :(


Hi, I´m having some troubles to update a DetailsView using an EntityDataSource, i get the following error:


The key-value pairs that define an EntityKey cannot be null or empty.
Parameter name: record

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.ArgumentException: The key-value pairs that define an EntityKey cannot be null or empty.
Parameter name: record

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentException: The key-value pairs that define an EntityKey cannot be null or empty.

Parameter name: record]

   System.Data.EntityKey.CheckValue(String argumentName, String keyFieldName, Object value, PrimitiveType expectedType) +3602373

   System.Data.EntityKey.CheckKeyValues(EntitySet entitySet, IExtendedDataRecord record, String[]& keyNames, Object& singletonKeyValue, Object[]& compositeKeyValues) +474

   System.Data.EntityKey..ctor(EntitySet entitySet, IExtendedDataRecord record) +161

   System.Data.Objects.ObjectStateManager.FixupKey(EntityEntry entry) +107

   System.Data.Objects.ObjectStateEntry.AcceptChanges() +143

   System.Data.Objects.ObjectContext.AcceptAllChanges() +212

   System.Web.UI.WebControls.EntityDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +372

   System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +92

   System.Web.UI.WebControls.DetailsView.HandleUpdate(String commandArg, Boolean causesValidation) +837

   System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +509

   System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs e) +95

   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37

   System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source, EventArgs e) +113

   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37

   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +118

   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135

   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10

   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13

   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

Can somebody help me? I´ve spent the last 4 hours around this, and don´t have any clue to solve this problem!!!

Nobody can point me to a solution, i can´t find any reference for this error! :(