Consultor Eletrônico



Kbase P183446: "Trying to update row outside a transaction" error when using Microsoft DataGridView .NET control
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/03/2011
Status: Unverified

SYMPTOM(s):

"Trying to update row outside a transaction" error when using Microsoft DataGridView .NET control

Modified field in Microsoft DataGridView .NET control

Moved focus off of DataGridView

Selecting the same row in the DataGridView and modifying field a second time fails with error 15599

ASSERT - Trying to update row outside a transaction. (15599)

FACT(s) (Environment):

Windows
OpenEdge 10.2x

CAUSE:

Bug# OE00198092

CAUSE:

The ProBindingSource relies on IEditableObject.BeginEdit and IEditableObject.EndEdit events to manage it's implicit transactions.
In the scenario outlined above, the IEditableObject.BeginEdit is not raised a second time when the same row is stepped into a second time, so the second edit operation fails to start it's implicit transaction.

FIX:

Possible workarounds:

1. Set the DataGridView's CausesValidation = False. This will change the way the DataGridView sends the BeginEdit and EndEdit events in a way that keeps the transaction open in case the control loses focus.
Additional code will be required to make sure the transaction is committed at the appropriate times.

2. Add an event handler for the DataGridView:CellEnter event which suspends and resumes the databinding, for example:

METHOD PRIVATE VOID wCustomerGrid_CellEnter( INPUT sender AS System.Object, INPUT e AS System.Windows.Forms.DataGridViewCellEventArgs ):
vCustSrc:suspendbinding().
vCustSrc:resumebinding().
RETURN.
END METHOD.