I have a very very simple form with a probindingsource attached to a datagrid. pbs handle is a query on a temp-table ("for each ttBlah"). the pbs has 'AutoUpdate' = true.
The user updates the cells. The changes are saved to the temp-table just fine. User clicks save. I then loop through a buffer of the temp-table (for each bttBlah...) and check the data. If the data is bad an error is presented and the user can make the necessary changes. At this point I modify a cell and once I leave the cell I get the following error and change is reverted:
--------------------
ASSERT - Trying to update row outside a transaction. (15599)
The Progress.Data.BindingSource supports a row-based transaction model. The user has inadvertently began editing a row outside a transaction. You cannot rely upon these changes to be assigned to the ABL DataSource.
--------------------
While typing this I had been trying different solutions to make this go away. If I run the query-prepare and query-open commands on the query attached to the pbs the error goes away.
Thought I would still share the solution/workaround since a search on the topic produced no relevant results.
Thanks,
Justin
You shouldn't be reopening your query to get around this issue. I wrote a sample appl following your steps and do not see the problem.
If you send along your code, I can take a look at it and see what the problem is.
Maura Regan
Hi Maura,
Sorry for the delay.
Find attached the code to reproduce the issue. No database necessary. Run runMe.p.
Steps to reproduce:
1) Edit 'Field 2'
2) Press Tab
3) Press Button, gives my data error and aborts the save routine.
4) Edit 'Field 3'
5) Press Tab - ASSERT Error.
Let me know what you find.
Justin
[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/2768.runMe.p.zip:550:0]
[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/0763.test1Form.cls.zip:550:0]
[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/3073.test1Form.resx.zip:550:0]
Hi Justin,
I'm able to reproduce your issue. I've determined that it's a DataGridView issue. I don't see the issue when I replace your datagridview with an Infragistics ultragrid.
Also, I've created a reproducible case outside of the ABL, with just a .NET solution which I will send along to Microsoft as a bug.
The problem has to do with the control's use of the BindingSource's BeginEdit() and EndEdit() calls. When you click on the button, the control calls the bs:EndEdit().
Then when you click back into the field, it doesn't call BeginEdit() (which the ultraGrid does do). When you make the change, and then tab out, the SetColValue() is called,
but throws the exception because you're not in a row transaction.
Unfortunately, I was not able to come up with a workaround, other than changing the bs:Position property, which is not what you want.
Maura
Justin,
I just heard back from Microsoft and they have a workaround for this issue. The workaround is to set the DataGridView's CausesValidation to False. I tried it and it works nicely.
Maura