对BindingSource的EndEdit中更新数据表,但仍RowState为不变 [英] EndEdit on BindingSource updates DataTable, but rowstate still unchanged

查看:1252
本文介绍了对BindingSource的EndEdit中更新数据表,但仍RowState为不变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有其中有一个数据源是一个DataTable。结果
中的所有WinForms控件增加了数据绑定到BindingSource一个BindingSource的

I have a bindingsource which has a datasource which is a datatable.
All the winforms controls has added databindings to the bindingsource

我做的在GUI中的值更改(写入控制的.text属性)

I do a value change in the GUI (writes to the controls' .text property)

然后保存我这样做以下

  bsSending.EndEdit();      



((DataRowView的)this.bsSending.Current).Row)现在包含新值,但的RowState 仍保持不变。这怎么可能?我没有任何通话的AcceptChanges()之前,我做在GUI中价值变动

((DataRowView)this.bsSending.Current).Row) now contains the new values, but the RowState is still unchanged. How can this be possible? I haven't any calls to AcceptChanges() before I make the value changes in the GUI

推荐答案

更新:

不知道为什么,但似乎在调用特定行的EndEdit中的伎俩。该行的母公司是一个DataTable,并表的数据集是bsSending数据源的数据源。
调用bsSending.EndEdit()只更新值,但不会更新RowState的。

Don't know why, but it seems that calling the specific row's EndEdit does the trick. The row's parent is a datatable and the table's dataset is the datasource of the bsSending Datasource. Calling bsSending.EndEdit() only updates the values but doesn't update the rowstate.

我冲浪对于类似的问题,.net和他们表明,调用的AcceptChanges()的数据集时,结合之前的数据,那么你可能会得到这个错误(值更新到数据集,但RowState的保持不变)。我还没有看到这个问题的任何溶液,虽然如此,我把我的解决方法解决方案

I have surfed the .net for similiar problems and they indicate that when calling AcceptChanges() on the dataset BEFORE binding data, then you may get this error (values updated to dataset but rowstate remains unchanged). I haven't seen any solutions to the problem, though, so I keep my workaround solution

这篇关于对BindingSource的EndEdit中更新数据表,但仍RowState为不变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆