0

这是一个使用 EF 的 VB.NET、Winforms 应用程序。在我的表单上,我有一个 datagridview、一个数据绑定源和一个 bindingNavigator... 我可以编辑 datagridview 的单元格,但是当我单击保存更改时,该值只会保存到我重新加载表单。?。?直接查看数据库表,我可以看到该值实际上从未改变.. 下面是处理点击的子..

Private Sub UnitBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnitBindingNavigatorSaveItem.Click
    UnitDataGridView.CommitEdit(DataGridViewDataErrorContexts.CurrentCellChange)
    db.SaveChanges()
End Sub

从我读过的内容来看,这似乎是我所需要的,但显然它以某种方式错了..

4

1 回答 1

0

I made a work around for it for the time being... I simply use the CellEndEdit event and get the row info from that. Next I get the value of the column that holds the id and update the database from there. Seems like a long way around but is the only way I can get it to write any data at the moment...

于 2012-09-22T01:48:39.500 回答