Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deleted row information cannot be accessed through the r
Message
De
04/08/2010 10:20:47
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
03/08/2010 16:10:45
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
ASP.NET
Divers
Thread ID:
01475066
Message ID:
01475145
Vues:
31
Hi Frank,

Instead of deleting the row from the dataset can you try asking the business object to delete it instead?
this.oPolicyRider.Delete(dsPolicyRider, e.RowIndex);
>Hi,
>
>I have a page that is used for editing a pretty standard 1 to many relationship between tables.
>
>The many side is edited through a GridView. When a row gets deleted from this GridView I need to recalculate something on the 1 side of the relatoinship. This is my code from the grdRiders_RowDeleting method:
>
>
        protected void grdRiders_RowDeleting(object sender, GridViewDeleteEventArgs e)
>        {
>            DataSet dsPolicyRider = (DataSet)Session["dsPolicyRider"];
>            dsPolicyRider.Tables[0].Rows[e.RowIndex].Delete();  //(dsPolicyRider, e.RowIndex);
>            this.BindControl(this.grdRiders);
>            this.CalculatePremium(true);
>        }
>
>This apparently works as the row is removed from the GridView, but then when I try to save this change I get this error:
>
>
Deleted row information cannot be accessed through the row. 
>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.DeletedRowInaccessibleException: Deleted row information cannot be accessed through the row.
>
>Source Error: 
>
>Line 67: 			{
>Line 68: 				if (this.Row != null)
>Line 69: 					return (Guid)mmType.GetNonNullableDbValue(this.Row["PolicyRiderPK"], "System.Guid");
>Line 70: 				else
>Line 71: 					return this._policyRiderPK;
>
>
>Source File: C:\Development\Mere Mortals .NET Framework 2008\SamaanSystems\IAS.Business\PolicyRider\PolicyRiderEntity.cs    Line: 69 
>
>Stack Trace: 
>
>[DeletedRowInaccessibleException: Deleted row information cannot be accessed through the row.]
>   System.Data.DataRow.GetDefaultRecord() +4814901
>   System.Data.DataRow.get_Item(String columnName) +22
>   SamaanSystems.IAS.Business.PolicyRiderEntity.get_PolicyRiderPK() in C:\Development\Mere Mortals .NET Framework 2008\SamaanSystems\IAS.Business\PolicyRider\PolicyRiderEntity.cs:69
>
>[TargetInvocationException: Exception has been thrown by the target of an invocation.]
>   System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
>   System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +71
>   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +350
>   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
>   System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) +53
>   System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) +20
>   OakLeaf.MM.Main.Collections.mmPropertyComparer`1.GetPropertyValue(Object objRef, String propertyName) +87
>   OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.GetPrimaryKeyValue(EntityType entity) +174
>   OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.CallStateChange(mmBusinessState bizState, EntityType entity) +50
>   OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.PreSaveEntityListProcessing(mmBindingList`1 entityList) +446
>   OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.PreSaveProcessing() +64
>   OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.CheckRules(mmBusinessObjectGeneric`1 businessObject, mmBindingList`1 entityList) +802
>   OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.CheckRules() +71
>   OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.CheckRules(mmBusinessObject businessObject, DataSet ds, String tableName) +97
>   OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName, String databaseKey, IDbDataAdapter dbAdapter) +410
>   OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName, String databaseKey) +53
>   OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName) +83
>   OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds) +74
>   OakLeaf.MM.Main.Web.UI.mmBusinessWebPage.Save(mmBusinessObject bizObj, DataSet ds, String tableName) +187
>   SamaanSystems.IAS.Web.PolicyEdit.btnSave_Click(Object sender, EventArgs e) in C:\Development\Mere Mortals .NET Framework 2008\SamaanSystems\IAS.Web\PolicyEdit.aspx.cs:892
>   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
>   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
>   System.Web.UI.WebControls.Button.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) +36
>   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
>
>
>Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3614
>
>If I comment out the CalculatePremium call, then I don't get the error.
>
>Can someone explain what is going on here and what to do to fix it, please?
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform