hello,
got a serious problem. following code:
now I change values in the DG an doing on every RowValidated event:
works fine. BUT if I insert a new row directly in my DB, it won't be shown in my DGV. So the commandbuilder only does a UPDATE..., and there is no SELECT... again to get updated DB-values. How to do that? I tried da.Fill(dt) but that adds the queryresult whitout clearing the existing. So I tried DGV.Rows.clear() but I get an errormessage, that I can#t use it. Is there an other solution?
thx
got a serious problem. following code:
VB.NET:
dt = New DataTable
da = New MySqlDataAdapter("SELECT ID, corr_KundenNr, ... FROM table1 WHERE corr_KundenNr = '" & Kundennummer & "'", conn)
da.Fill(dt)
cb = New MySqlCommandBuilder(da)
dt.Columns("corr_KundenNr").DefaultValue = Kundennummer
DGV.DataSource = dt
now I change values in the DG an doing on every RowValidated event:
VB.NET:
DGV.EndEdit()
Dim changes As DataTable = dt.GetChanges()
If Not changes Is Nothing Then
da.Update(changes)
dt.AcceptChanges()
End If
Me.Refresh()
works fine. BUT if I insert a new row directly in my DB, it won't be shown in my DGV. So the commandbuilder only does a UPDATE..., and there is no SELECT... again to get updated DB-values. How to do that? I tried da.Fill(dt) but that adds the queryresult whitout clearing the existing. So I tried DGV.Rows.clear() but I get an errormessage, that I can#t use it. Is there an other solution?
thx