datagridview&;mysql更新错误
我使用下面的代码通过datagridview更新mysql视图datagridview&;mysql更新错误,mysql,vb.net,datagridview,Mysql,Vb.net,Datagridview,我使用下面的代码通过datagridview更新mysql视图 For Each row1 As DataGridViewRow In DataGridView2.Rows If Not row1.IsNewRow Then DataGridView2.CurrentCell = DataGridView2(0, ii)
For Each row1 As DataGridViewRow In DataGridView2.Rows
If Not row1.IsNewRow Then
DataGridView2.CurrentCell = DataGridView2(0, ii)
DataGridView2(2, ii).Value = intCaja
ii = ii + 1
End If
'Application.DoEvents()
DataGridView2.EndEdit()
da1.Update(ds1, "data")
Next
这段代码运行得很好,只是它只更新了最后一条记录之外的所有记录,尽管我在datagridview中看到它已更新
For Each row1 As DataGridViewRow In DataGridView2.Rows
If Not row1.IsNewRow Then
DataGridView2.CurrentCell = DataGridView2(0, ii)
DataGridView2(2, ii).Value = intCaja
ii = ii + 1
End If
'Application.DoEvents()
DataGridView2.EndEdit()
da1.Update(ds1, "data")
Next
我曾尝试刷新datagrid或使用它的更新方法,但没有任何运气我将在这里添加我的答案,仅针对像我昨天一样可能遇到这个简单问题的人,尽管我没有收到来自这个社区的任何积极反馈 只需确保在
datagridview2.endedit()方法之前添加以下行
DataGridView2.CurrentCell = Nothing
感谢stackoverflow没有提供任何帮助,也感谢那个人,他很高兴降级这个Q事实上,我不明白我问这个问题并试图得到答案的意思,不管对你来说容易与否,发现你不喜欢Qs或者觉得对你来说很容易,如果你不想帮忙,那么请说这只是为专业人士准备的,不欢迎初学者,所以我们将永远离开这个社区,因为你把这个Q降级为没用,我在谷歌上试了几个小时,但没有任何运气,并没有说在这里询问而不是搜索或尝试很容易。此外,我只粘贴了几行代码,其中包括大量的行